Weird query speed

From: "Rigmor Ukuhe" <rigmor(dot)ukuhe(at)finestmedia(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Weird query speed
Date: 2004-01-15 16:02:52
Message-ID: OEEHLFAIJHHMABJPIANIGELICHAA.rigmor.ukuhe@finestmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


Almoust identical querys are having very different exec speed (Postgresql
7.2.4).

query: select "NP_ID" from a WHERE "NP_ID" > '0'
Index Scan using NP_ID_a on a (cost=0.00..13.01 rows=112 width=4) (actual
time=16.89..18.11 rows=93 loops=1)
Total runtime: 18.32 msec
-------------------------------------------------
query: select "NP_ID" from a WHERE "NP_ID" > '1'
Index Scan using NP_ID_a on a (cost=0.00..13.01 rows=112 width=4) (actual
time=0.08..1.36 rows=93 loops=1)
Total runtime: 1.56 msec

From where such difference comes?

There are about 37K rows and only about 100 of then are not "NP_ID" = 0

For a workaround i use WHERE "NP_ID" >= '1' and if works as speedy as '> 1'

Rigmor Ukuhe
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 08.01.2004

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Richard Huxton 2004-01-15 16:10:38 Re: Trigger question
Previous Message Tom Lane 2004-01-15 15:44:41 Re: insert speed - Mac OSX vs Redhat