Precomputed constants?

From: Böszörményi Zoltán <zboszor(at)dunaweb(dot)hu>
To: pgsql-performance(at)postgresql(dot)org
Subject: Precomputed constants?
Date: 2006-06-14 10:53:54
Message-ID: 3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

here's my problem:

# explain analyze select * from mxstrpartsbg where szam =
round(800000*random())::integer;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
Seq Scan on mxstrpartsbg (cost=0.00..56875.04 rows=1 width=322) (actual
time=190.748..1271.664 rows=1 loops=1)
Filter: (szam = (round((800000::double precision * random())))::integer)
Total runtime: 1271.785 ms
(3 rows)

# explain analyze select * from mxstrpartsbg where szam = 671478;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------
Index Scan using mxstrpartsbg_pkey on mxstrpartsbg (cost=0.00..5.87
rows=1 width=322) (actual time=71.642..71.644 rows=1 loops=1)
Index Cond: (szam = 671478)
Total runtime: 71.706 ms
(3 rows)

Is there a way to have PostgreSQL to pre-compute all the constants in the
WHERE clause? It would be a huge performance gain. Thanks in advance.

Best regards,
Zoltán Böszörményi

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Volkan YAZICI 2006-06-14 11:07:13 Re: Precomputed constants?
Previous Message Sven Geisler 2006-06-14 08:26:43 Re: how to partition disks