[ruby-dbi-users] dbd_pg and deallocating prepared statements

Erik Hollensbe erik at hollensbe.org
Wed Aug 27 03:43:50 EDT 2008


On Tuesday 26 August 2008 18:56:40 KUBO Takehiro wrote:
> Pardon me if I'm not correct. I have been interested in how various
> DBMSs implement prepared statements. But I have not used postgresql
> for 9 years.
>
> dbd_pg uses prepared statements for all queries. But who deallocate the
> prepared statements? "@stmt.clear if @stmt" doesn't do it.
> IMO, if a ruby process uses one database session for all SQL statements
> and issues them periodically, server side (postmaster) memory will be
> increased as time goes.

Correct. I explored this a bit when that patch was provided and I couldn't 
find anything in the pg driver that allowed me to cleanly close statements, 
and (inappropriately) made the assumption that they would at some point be 
collected.

I will try and get a fix out this week. Thanks.

-Erik


More information about the ruby-dbi-users mailing list