Search Postgresql Archives

Re: debugging plpgsql functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris wrote:
Hi all,

I have a few plpgsql functions to debug to see why they are slow.

They consist of a bunch of sql statements using new.* / old.* variables (ie not using "EXECUTE", the sql is being called directly).

Is there a way to capture the actual sql that's being executed with variables substituted in, or even an easy way to log the variables being used?

I couldn't see anything in the manual but maybe I missed something - any pointers appreciated.

I tried http://pgfoundry.org/projects/edb-debugger/ but after loading the module, the functions wouldn't run properly (can't remember the error message but I can do it again if need be).
Debugging sql functions is sometimes a not to fun event. pgdebugger has some gotchas that will bite you big time. One big item don't run pgdebugger in a production machine i've had lock process and its done some other odd things. I normally run the pgdebugger on a windows install as it will install it for you. and use pgadmin two step through the code.

One option use Raise Notice to  see whats in a variable example
RAISE NOTICE  'Var1 %, Var2 %, ' , MemoryVar1, MemoryVar2 ;

then look whats returned to the client. Again i use pgAdmin for this as it shows me all the messages sent from the server and keeps a nice easy to read history.

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux