pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: arnaulist@andromeiberica.com
Cc: PostgreSQL Performance <pgsql-performance@postgresql.org>
Subject: Re: Performace comparison of indexes over timestamp fields
Date: Tue, 22 May 2007 10:11:28 -0400
Message-ID: <12213.1179843088@sss.pgh.pa.us> (raw)
In-Reply-To: <4652C846.4020801@andromeiberica.com>
References: <4652C846.4020801@andromeiberica.com>

Arnau <arnaulist@andromeiberica.com> writes:
> As you can see the time difference are very big
>    Timestamp:        318.328 ms
>    int8 index:       120.804 ms
>    double precision: 57.065 ms

As already suggested elsewhere, you probably weren't sufficiently
careful in taking your measurements.

A look at the code says that int8 comparison ought to be the fastest
of these.  If timestamps are implemented as floats (which you didn't
say) their comparison speed ought to be *exactly* the same as floats,
because the comparison functions are line-for-line the same.  If
timestamps are implemented as int8 then they should be similar to
int8 comparisons, maybe a tad slower due to an extra level of function
call.  But in any case it seems likely that the actual comparison
function calls would be just a small fraction of the runtime.

			regards, tom lane



view thread (5+ messages)

Message-ID: <12213.1179843088@sss.pgh.pa.us>
Permalink:  ../12213.1179843088@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12213.1179843088@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, arnaulist@andromeiberica.com
  Subject: Re: Performace comparison of indexes over timestamp fields
  In-Reply-To: <12213.1179843088@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox