Re: seq scan in the case of max() on the primary key column
От | Marti Raudsepp |
---|---|
Тема | Re: seq scan in the case of max() on the primary key column |
Дата | |
Msg-id | BANLkTim5saGCxhLCAx4nEUQ4tZuOSy65fg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: seq scan in the case of max() on the primary key column (Shaun Thomas <sthomas@peak6.com>) |
Ответы |
Re: seq scan in the case of max() on the primary key column
Re: seq scan in the case of max() on the primary key column |
Список | pgsql-performance |
On Thu, Jun 16, 2011 at 21:36, Shaun Thomas <sthomas@peak6.com> wrote: > You can call that instead of max, and it'll be much faster. You can create > an analog for min if you need it. So for this, you'd call: Cool, I've needed this function sometimes but never bothered enough to write it myself. Now I created a wiki snippet page for this handy feature here: https://wiki.postgresql.org/wiki/Efficient_min/max_over_partitioned_table With Jim Nasby's idea to use regclass instead of relation names, the function is now half its length and probably more reliable. There's no need to touch pg_class directly at all. I also changed it to return bigint instead of integer, as that's more versatile, and the performance loss is probably negligible. Regards, Marti
В списке pgsql-performance по дате отправления: