skip to Main Content

Postgresql – Select count query very slow on cold cache

Problem The following query takes 42 seconds when most of the data in not cached: EXPLAIN (ANALYZE, BUFFERS) select count(*) from packages where company_id = 178381; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=395914.63..395914.63 rows=1 width=8) (actual time=42411.940..42411.942 rows=1 loops=1) Buffers: shared hit=21775…

VIEW QUESTION

Postgresql – De-duplicate part of a table on given condition

This is my message table. Now I am trying to write an query to group records by collection_id (only first instance) if type multi-store else by message.id . id | collection_id | type | affiliation_id | status | scheduled_for_date --------------------------------------+--------------------------------------+----------------+----------------+--------------+--------------------…

VIEW QUESTION
Back To Top
Search