On Sun, May 15, 2016 at 10:22 AM, Anderson Carniel <accarn...@gmail.com> wrote: > Thank you very much Joe. > > I have followed the crosstab() implementation and understood the idea of per > query memory context. Now, I am using a unique SPI instance (which I perform > several sql queries), process the result, transform my result into a > tuplestore, close the SPI and done. It works perfectly. > > I have a curiosity with regard to the tuplestore: is there a problem with > performance if my tuplestore form a big table with million of tuples? Other > question is regarding to SPI: is there a problem to use only one instance > of SPI (for instance, if multiple users call the same function)?
When using a tuplestore, one concern for performance is the moment data is going to spill into disk, something that is set with maxKBytes in tuplestore_begin_heap(). Using work_mem is the recommendation, though you could tune it better depending on your needs. -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers