aggregate planning with partitions
| От | Jonathan Ellis |
|---|---|
| Тема | aggregate planning with partitions |
| Дата | |
| Msg-id | e06563880703050825m194267dak43c58d6c104453e8@mail.gmail.com обсуждение исходный текст |
| Список | pgsql-general |
I have a table, "connection_events", partitioned via inheritance on a column "logtime." I'm running 8.2. Mostly the partitioning works pretty well. I have noticed though that the query select max(logtime) from connection_events always uses seq_scan across all partitions, which is painful. (Rephrasing it as a limit query does not change the plan.) I've run analyze, and pg can tell that in a single partition using the logtime index is the right thing to do, but it can't when the main table is queried. I can write a function to force index use by querying each partition separately but I wanted to know if (a) there is a simpler solution I'm missing and (b) if there is a generalizable principle here that can help me avoid problems with the planner in the future. (From my single data point I would guess "avoid aggregates" but that may be oversimplified.) Thanks, -Jonathan
В списке pgsql-general по дате отправления: