Precomputed constants?
От | Böszörményi Zoltán |
---|---|
Тема | Precomputed constants? |
Дата | |
Msg-id | 3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu обсуждение исходный текст |
Ответы |
Re: Precomputed constants?
|
Список | 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 по дате отправления: