I have a star schema here and I am querying the fact table and would like to join one very small dimension table. I can’t really explain the following: EXPLAIN ANALYZE SELECT COUNT(impression_id), …
Tag: postgresql-performance
Optimize BETWEEN date statement
I need help optimizing a Postgres query which uses the BETWEEN clause with a timestamp field. I have 2 tables: containing about 3394 rows containing about 4000000 rows There are btree indexes on both PKs id_one and id_two, on the FK id_one and cut_time. I want to perform a query like: This query retrieves about 1.700.000 rows in about 7
Best way to delete millions of rows by ID
I need to delete about 2 million rows from my PG database. I have a list of IDs that I need to delete. However, any way I try to do this is taking days. I tried putting them in a table and doing it in batches of 100. 4 days later, this is still running with only 297268 rows deleted.