Re: Querying w/ join slow for large/many child tables

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Querying w/ join slow for large/many child tables
Дата
Msg-id 81686f48-1010-2176-5853-52881e549c4c@aklaver.com
обсуждение исходный текст
Ответ на Querying w/ join slow for large/many child tables  (Wells Oliver <wells.oliver@gmail.com>)
Список pgsql-general
On 1/29/19 6:49 PM, Wells Oliver wrote:
> I have a primary parent table with a child table per week of the year 
> for each week back through 2015. There are a lot of child tables. Each 
> week's child table has maybe  80-110m rows.
> 
> When I join to the parent table on a column, it's very slow, but when I 
> manually specify the specific week's child table, it's quite fast, e.g.
> 
> Slow:
> select * from foo
> join schema.mytable on foo.col = mytable.col
> 
> vs. fast:
> select * from foo
> join schema.mytable_2015_wk33 as mytable on foo.col = mytable.col
> 
> What's the resolution to make querying the table faster in terms of it 
> finding the appropriate child table? Is it putting an index on `col` on 
> each child table? Some other thing?

https://wiki.postgresql.org/wiki/Slow_Query_Questions

> 
> Thank you.
> 
> -- 
> Wells Oliver
> wells.oliver@gmail.com <mailto:wellsoliver@gmail.com>


-- 
Adrian Klaver
adrian.klaver@aklaver.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Wells Oliver
Дата:
Сообщение: Querying w/ join slow for large/many child tables
Следующее
От: Abdullah Al Maruf
Дата:
Сообщение: Re: pg_rewind success even though getting error 'record withincorrect prev-link'