Re: Query slow for new participants

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Query slow for new participants
Дата
Msg-id 38d1ac81dfb700d154290aa35f513320d9fd093e.camel@cybertec.at
обсуждение исходный текст
Ответ на Re: Query slow for new participants  ("support@mekong.be" <support@mekong.be>)
Список pgsql-performance
support@mekong.be wrote:
> EXPLAIN (ANALYZE, BUFFERS), not just EXPLAIN
> "Index Scan using ix_companyarticledb_company on companyarticledb  (cost=0.57..2.80 rows=1 width=193) (actual
time=1011.335..1011.454rows=1 loops=1)"
 
> "  Index Cond: (companyid = 77)"
> "  Filter: (articleid = 7869071)"
> "  Rows Removed by Filter: 2674361"
> "  Buffers: shared hit=30287"
> "Planning time: 0.220 ms"
> "Execution time: 1011.502 ms"

Your problem are the "Rows Removed by Filter: 2674361".

The first thing I would try is:

  ALTER TABLE public.companyarticledb
     ALTER companyid SET STATISTICS 1000;

  ALTER TABLE public.companyarticledb
     ALTER articleid SET STATISTICS 1000;

  ANALYZE public.companyarticledb;

Then PostgreSQL has a better idea which condition is selective.

You can set STATISTICS up to 10000, but don't forget that high values
make ANALYZE and planning slower.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com



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

Предыдущее
От: "support@mekong.be"
Дата:
Сообщение: Re: Query slow for new participants
Следующее
От: Fd Habash
Дата:
Сообщение: What is pg_stat_user_tables Showing NULL for last_autoanalyze &last_autovacuum