Re: postgres_fdw: using TABLESAMPLE to collect remote sample

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: postgres_fdw: using TABLESAMPLE to collect remote sample
Дата
Msg-id 84afe85f-2aa0-5aef-fa4a-59759afc03fb@enterprisedb.com
обсуждение исходный текст
Ответ на Re: postgres_fdw: using TABLESAMPLE to collect remote sample  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Ответы Re: postgres_fdw: using TABLESAMPLE to collect remote sample
Список pgsql-hackers
Hi,

here's a slightly updated version of the patch series. The 0001 part
adds tracking of server_version_num, so that it's possible to enable
other features depending on it. In this case it's used to decide whether
TABLESAMPLE is supported.

The 0002 part modifies the sampling. I realized we can do something
similar even on pre-9.5 releases, by running "WHERE random() < $1". Not
perfect, because it still has to read the whole table, but still better
than also sending it over the network.

There's a "sample" option for foreign server/table, which can be used to
disable the sampling if needed.

A simple measurement on a table with 10M rows, on localhost.

  old:        6600ms
  random:      450ms
  tablesample:  40ms (system)
  tablesample: 200ms (bernoulli)

Local analyze takes ~190ms, so that's quite close.


regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Вложения

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: adding 'zstd' as a compression algorithm
Следующее
От: Robert Haas
Дата:
Сообщение: Re: adding 'zstd' as a compression algorithm