Re: seq scan in the case of max() on the primary key column

Поиск
Список
Период
Сортировка
Искать
От
Shaun Thomas
Тема
Re: seq scan in the case of max() on the primary key column
Дата
Msg-id
4DFB4C02.3020505@peak6.com
Ответ на
Список
Дерево обсуждения
seq scan in the case of max() on the primary key column Svetlin Manavski <svetlin.manavski@gmail.com>
Re: seq scan in the case of max() on the primary key column Jesper Krogh <jesper@krogh.cc>
Re: seq scan in the case of max() on the primary key column Magnus Hagander <magnus@hagander.net>
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 Jim Nasby <jim@nasby.net>
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 Svetlin Manavski <svetlin.manavski@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 Greg Smith <greg@2ndQuadrant.com>
Re: seq scan in the case of max() on the primary key column Marti Raudsepp <marti@juffo.org>
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 Scott Marlowe <scott.marlowe@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 Greg Smith <greg@2ndQuadrant.com>
Re: seq scan in the case of max() on the primary key column Greg Smith <greg@2ndQuadrant.com>
On 06/17/2011 06:22 AM, Svetlin Manavski wrote:

> Shaun, that solution is brilliant.

Don't thank me. I actually got the basic idea from a post here a couple 
years ago. The only difference is I formalized it somewhat and put it in 
our utility schema, where I put lots of other random useful stored procs 
I've accumulated over the years. I have another one that works with 
dates. :)

I assume you already modified it by removing the 'utility' schema prefix 
from the recursive call. The recursive call is in case the child tables 
are themselves used as a template for further inheritance. It's rare, 
but possible. This function will always get you the max value on a 
column in a series of partitioned tables, and quickly so long as it's 
indexed.

It's a bit of a hack, but it's worked fine for us while we wait for the 
planner to catch up. :)

-- 
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604
312-676-8870
sthomas@peak6.com

______________________________________________

See  http://www.peak6.com/email_disclaimer.php
for terms and conditions related to this email
В списке pgsql-performance по дате отправления
От: jesper@krogh.cc
Дата:
От: Merlin Moncure
Дата:
FAQ