Steven
02/02/2023, 9:55 AMBolek Ziobrowski
02/02/2023, 10:15 AMSteven
02/02/2023, 10:16 AMBolek Ziobrowski
02/02/2023, 10:20 AMselect ts, last(field1), last(field), ...
from
(
your_query
) group by ts
but it might be more performant to alter your query not to produce duplicates .Steven
02/02/2023, 10:22 AMProductboard
02/02/2023, 10:44 AMBolek Ziobrowski
02/02/2023, 10:46 AMMatt
02/02/2023, 6:19 PMrow_number()
.row_number()
example.
• The results are identical.
• The performance is identical for this very small query (≈42ms).
• But the explain plan is distinctly different, and I suspect it will be generally better.
select
cab_type, vendor_id, pickup_datetime, trip_distance
from trips
where pickup_datetime between '2009-01-01T00:02:56.000000Z' and '2009-01-01T00:03:00.000000Z'
latest on pickup_datetime PARTITION BY cab_type, vendor_id;