Received: from mta2.snet.net (mta2.snet.net [204.60.203.71]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0AKQvB14041 for ; Thu, 10 Jan 2002 15:26:57 -0500 (EST) (envelope-from wweng@kencast.com) Received: from pop.snet.net ([204.60.203.73]) by mta2.snet.net (8.12.1/8.12.1/SNET-smtp-1.1/D-1.1/O-1.1) with ESMTP id g0AKQqBB026176; Thu, 10 Jan 2002 15:26:53 -0500 (EST) Received: from Monet (167.95.252.64.snet.net [64.252.95.167]) by pop.snet.net (8.12.1/8.12.1/SNET-pop-1.2/D-1.2/O-1.3) with SMTP id g0AKQf2T000516; Thu, 10 Jan 2002 15:26:44 -0500 (EST) Date: Thu, 10 Jan 2002 15:33:46 -0500 From: Wei Weng To: Stephan Szabo Cc: pgsql-sql@postgresql.org Subject: Re: Resources Message-Id: <20020110153346.41367a49.wweng@kencast.com> In-Reply-To: <20020110080801.G82370-100000@megazone23.bigpanda.com> References: <4423720517.20020110190329@indvalley.com> <20020110080801.G82370-100000@megazone23.bigpanda.com> Organization: KenCast Inc. X-Mailer: Sylpheed version 0.6.6 (GTK+ 1.2.10; i586-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200201/77 X-Sequence-Number: 6167 I have a side question. How do I stop this kind of crazy query to suck up my CPU power if it is fed by a database driver? (like ODBC, for example) Since kill -9 postmaster is highly not recommended, can i do a /sbin/service postgresql stop to force it to shut down? (I am a redhat user.) Thank you! On Thu, 10 Jan 2002 08:12:12 -0800 (PST) Stephan Szabo wrote: > On Thu, 10 Jan 2002, Gurudutt wrote: > > > I have a pentium III server, running on RHL 7.1 with 256 MB RAM, > > > > The following is output of the "top" command for query which involves > > fetch from a table with about MAX of 10,000 rows. > > > > -------------------------------------TOP------------------------------ > > PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND > > > > 3174 postgres 19 0 3328 3328 2672 R 99.0 1.3 0:58 > > postmaster 1199 nobody 9 0 3728 3728 2704 S 0.5 1.4 > > 0:03 httpd 3035 root 10 0 1048 1048 840 R 0.3 0.4 > > 0:15 top 1 root 8 0 544 544 472 S 0.0 0.2 0:04 > > init 2 root 9 0 0 0 0 SW 0.0 0.0 0:00 > > keventd 3 root > > > > > > Now, my question is, it takes ages(2 mints) for the query to run > > (regularly VACUUM ANALYZED Database) and if you look closely at the > > resources consumed by the postgres, it is almost taking away 100% CPU > > time. > > > > How can we make it faster and to consume less resources ?? > > > > Can anybody suggest the steps they are taking for time-critical > > applications to run efficiently. > > An important thing is checking the explain output for the query. If you > want to post the schema, query and explain output, we might be able to > come up with suggestions on that level. > > You may also want to look at your ram usage. The default shared buffers > and sort memory are very low and you'll probably want to raise them. > You don't want to make them too big because you want to leave memory for > disk caching, but you can raise them to low thousands and see if that > helps. > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > -- Wei Weng Network Software Engineer KenCast Inc.