Re: [GENERAL] Differences when calling query inside and outside cursor

2013-02-13 Thread Albe Laurenz
Carlos Henrique Reimer wrote: > We're facing a weird performance problem in one of our PostgreSQL servers > running 8.0.26. Ouch. 8.0 has been out of support since October 2010, and I am afraid that might be a problem for you. > What can explain the difference between calling same query inside a

Re: [GENERAL] Differences when calling query inside and outside cursor

2013-02-13 Thread Carlos Henrique Reimer
Hi, As we suspected the SELECT inside a cursor is using a different plan than outside a cursor: pgipm=# explain analyze DECLARE CUR1 CURSOR FOR pgipm-# SELECT XMAX, ANO, MES, CODFUNC, SEQFUNC, TIPOPGTO, CODPD, HRSPD, VLRPD, MESANO, TIPOCALCFERIAS, VLRBASE FROM fparq.cadpagwhere (ANO >'2013')