On Sun, Jan 5, 2014 at 12:00 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > > > Looking at this example makes me wonder if it wouldn't be worthwhile to > provide a way to reset and re-use a tuplesort object, instead of redoing > all the lookup work involved. Or maybe just find a way to cache the > catalog lookups that are happening inside tuplesort_begin_datum, which are > about 50% of that function's cost it looks like. We're paying this same > kind of price for repeated tuplesort setup in the existing nodeAgg code, > if we have an aggregate with ORDER BY or DISTINCT in a grouped query with > many groups. > > This sounds very similar to: http://www.postgresql.org/message-id/caaphdvrbq348m8dyj-7o4vae5ps9zoq_34rgvaan1qyxl2s...@mail.gmail.com A reset function was added in the next patch which improved performance in my test case by about 5 times.
Perhaps they can make use of the same function. Regards David Rowley > regards, tom lane > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers >