Re: Best design for performance

Поиск
Список
Период
Сортировка
От Claudio Freire
Тема Re: Best design for performance
Дата
Msg-id CAGTBQpYRjtdHi9J30vjVV1--rsq4q4UZPMj5zZ2fy032niSQaA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Best design for performance  ("Riaan Stander" <rstander@exa.co.za>)
Ответы Re: Best design for performance
Список pgsql-performance
> From: Claudio Freire [mailto:klaussfreire@gmail.com]
>
> How did you query the table's size? You're probably failing to account for TOAST tables.
>
> I'd suggest using pg_total_relation_size.
...
On Mon, Mar 27, 2017 at 10:17 PM, Riaan Stander <rstander@exa.co.za> wrote:
> I'm using the first query from here.
> https://wiki.postgresql.org/wiki/Disk_Usage

Please don't top post.

It's a surprisingly big difference. TOAST could be compressing the
array, but I wouldn't expect it to be that compressible. Do you have
any stats about the length of the site array per row?

> The plan is to do the rights checking in the application. The join solution gets used for reports to filter data &
clientadhoc queries. 

Especially for reporting queries, you want the planner's stats to be
as accurate as possible, and placing a literal sites arrays in the
query in my experience is the best way to achieve that. But that is
indeed limited to reasonably small arrays, thereby the need to have
both variants to adapt the query to each case.

If you can't afford to do that change at the application level, I
would expect that the original schema without the array should be
superior. The array hides useful information from the planner, and
that *should* hurt you.

You'll have to test with a reasonably large data set, resembling a
production data set as much as possible.


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

Предыдущее
От: "Riaan Stander"
Дата:
Сообщение: Re: Best design for performance
Следующее
От: Riaan Stander
Дата:
Сообщение: Re: Best design for performance