From: | Ľubomír Varga <luvar(at)plaintext(dot)sk> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | suggestion to improve planer |
Date: | 2009-09-03 08:35:11 |
Message-ID: | 200909031035.11320.luvar@plaintext.sk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi.
I hope, that this is right mailing list.
SELECT date, value FROM t_event
WHERE t_event.id in (SELECT id FROM t_event
WHERE date < '2009-08-25'
ORDER BY date DESC LIMIT 1)
ORDER BY date;
cost 6.4
SELECT date, value FROM t_event
WHERE t_event.id = (SELECT id FROM t_event
WHERE date < '2009-08-25'
ORDER BY date DESC LIMIT 1)
ORDER BY date;
cost 6.36..6.37
Why that two query dont have equal cost? If it is not problem, try add some
planer code to recognize that sublesect HAVE TO return just one row (limit 1)
and in plan could be used filter/index scan instead of hash aggregate. I have
also some complex query examples where cost difference is more visible.
Have a nice day.
--
Odborník na všetko je zlý odborník. Ja sa snažím byť výnimkou potvrdzujúcou
pravidlo.
From | Date | Subject | |
---|---|---|---|
Next Message | Itagaki Takahiro | 2009-09-03 09:59:55 | Concurrent execution of pg_relation_size and DROP TABLE |
Previous Message | Magnus Hagander | 2009-09-03 07:52:45 | Fwd: Copy out wording |