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 ArticleAnswer 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 ArticleHow 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
More Pages to Explore .....