[PERFORM] Getting an optimal plan on the first execution of a pl/pgsql function

2015-12-14 Thread Pedro França
I have a really busy function that I need to optimize the best way I can. This function is just a nested select statement that is requested several times a sec by a legacy application. I'm running a PostgreSQL 9.4 on a CentOS 6; The indexes are in place but I've noticed that it is only used after

Re: [PERFORM] Getting an optimal plan on the first execution of a pl/pgsql function

2015-12-14 Thread Pedro França
Thank you for the replies guys, The output of auto-explain pratically comfirms what you say (sorry there are some portuguese words in there). I will try pgpooler. < 2015-12-14 18:10:02.314 BRST >LOG: duration: 0.234 ms plan: Query Text: SELECT teqp.eqpID, teqp.eqpveiID AS veiID, tcb.tcbID,