X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E7BB7D1CA4E for ; Wed, 2 Jun 2004 17:18:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13495-01 for ; Wed, 2 Jun 2004 20:18:02 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id AE2E4D1B1AE for ; Wed, 2 Jun 2004 17:17:59 -0300 (ADT) Received: from [192.168.1.45] (dsl093-038-087.pdx1.dsl.speakeasy.net [66.93.38.87]) (authenticated) by hosting.commandprompt.com (8.11.6/8.11.6) with ESMTP id i52KHwK07840; Wed, 2 Jun 2004 13:17:58 -0700 Message-ID: <40BE35EF.8030003@commandprompt.com> Date: Wed, 02 Jun 2004 13:17:51 -0700 From: Robby Russell Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: A Palmblad Cc: pgsql-php@postgresql.org Subject: Re: PHP memory usage References: <005501c44755$5a851580$97019696@AERS04> In-Reply-To: <005501c44755$5a851580$97019696@AERS04> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200406/2 X-Sequence-Number: 2776 A Palmblad typed this on 05/31/2004 02:22 PM: > We've been running into some issues with PHP and Postgres, and memory usage. > On a dual athlon 64, w/ 4 gigs of RAM, PHP 4.3.6, and Postgres 7.4.2 I've > seen our server start to crawl after some queries returning very large > result sets. Although large result sets aren't exactly what we want to be > dealing with, I really want to avoid a situation where a user could disrupt > our server with certain options to some searches. > > I did a quick commandline test, and it looks like PHP starts to eat memory > during its call to pg_query. By eat memory, I mean use memory well in > excess of php.ini's memory_limit of 8 megs. (I stop it around 90% of > available memory usage) Is this acceptable behaviour, or should I report it > to PHP as a bug? If not, are my only solutions to wrap my selects in > cursors and/or to use limit? > > -Adam Palmblad > I am going to take a quick guess and suggest that test those queries in psql itself. You might be running into some issues with your queries. Test your queries with psql, EXPLAIN. \h EXPLAIN -Robby -- Robby Russell, | Sr. Administrator / Lead Programmer Command Prompt, Inc. | http://www.commandprompt.com rrussell@commandprompt.com | Telephone: (503) 667.4564