Precomputed constants? - Mailing list pgsql-performance

From Böszörményi Zoltán
Subject Precomputed constants?
Date
Msg-id 3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu
Whole thread Raw
Responses Re: Precomputed constants?
List 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


pgsql-performance by date:

Previous
From: Sven Geisler
Date:
Subject: Re: how to partition disks
Next
From: Volkan YAZICI
Date:
Subject: Re: Precomputed constants?