My table is:
price: numeric, time: timestamp, type: integer
i want to group by type and for each group find max price and earliest (by time) price.
from the computational perspective, it's a simple linear / reduce-like operation. but how can it be done in postgres? is there some existing function like that? do i have to create my own aggregate? should i encode two field into one like $time-$price and just find minimum from it?