Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id E02519FB259 for ; Tue, 22 May 2007 11:11:39 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 02132-02 for ; Tue, 22 May 2007 11:11:27 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 574199FB24C for ; Tue, 22 May 2007 11:11:32 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l4MEBTfk012214; Tue, 22 May 2007 10:11:29 -0400 (EDT) To: arnaulist@andromeiberica.com cc: PostgreSQL Performance Subject: Re: Performace comparison of indexes over timestamp fields In-reply-to: <4652C846.4020801@andromeiberica.com> References: <4652C846.4020801@andromeiberica.com> Comments: In-reply-to Arnau message dated "Tue, 22 May 2007 12:39:02 +0200" Date: Tue, 22 May 2007 10:11:28 -0400 Message-ID: <12213.1179843088@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/439 X-Sequence-Number: 24829 Arnau 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