Gregory Stark <stark@xxxxxxxxxxxxxxxx> writes: > You can simulate such a plan with the subqueries I described but > there's a bit more overhead than necessary and you need a reasonably > efficient source of the distinct ids. Yeah, that seems like the $64 question. If you have no better way of finding out the set of ID values than a seqscan, then there's no point in trying to optimize the min/max accumulation ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend