Quantcast
Channel: How to make DISTINCT ON faster in PostgreSQL? - Database Administrators Stack Exchange
Browsing all 3 articles
Browse latest View live

Answer by Erwin Brandstetter for How to make DISTINCT ON faster in PostgreSQL?

For only 400 stations, this query will be massively faster:SELECT s.station_id, l.submitted_at, l.level_sensorFROM station sCROSS JOIN LATERAL ( SELECT submitted_at, level_sensor FROM station_logs...

View Article



Answer by Abelisto for How to make DISTINCT ON faster in PostgreSQL?

Try the classic way:create index idx_station_logs__station_id on station_logs(station_id);create index idx_station_logs__submitted_at on station_logs(submitted_at);analyse station_logs;with t as (...

View Article

How to make DISTINCT ON faster in PostgreSQL?

I have a table station_logs in a PostgreSQL 9.6 database: Column | Type | ---------------+-----------------------------+ id | bigint | bigserial station_id | integer | not null submitted_at | timestamp...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images