Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A78BB37BA5B for ; Mon, 29 Sep 2008 05:30:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 72534-01 for ; Mon, 29 Sep 2008 05:29:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from marjan.fesb.hr (marjan.fesb.hr [161.53.166.3]) by postgresql.org (Postfix) with ESMTP id B802B37BA30 for ; Mon, 29 Sep 2008 05:29:51 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by marjan.fesb.hr (Postfix) with ESMTP id 40B56304ED; Mon, 29 Sep 2008 10:29:49 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at marjan.fesb.hr Received: from marjan.fesb.hr ([127.0.0.1]) by localhost (marjan.fesb.hr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E95a3TXTdTFF; Mon, 29 Sep 2008 10:29:45 +0200 (CEST) Received: from www.fesb.hr (localhost [127.0.0.1]) by marjan.fesb.hr (Postfix) with ESMTP id 8834D303BB; Mon, 29 Sep 2008 10:29:45 +0200 (CEST) Received: from 161.53.168.65 (SquirrelMail authenticated user kiki) by www.fesb.hr with HTTP; Mon, 29 Sep 2008 10:29:45 +0200 (CEST) Message-ID: <50443.161.53.168.65.1222676985.squirrel@www.fesb.hr> In-Reply-To: References: <50724.193.198.80.76.1222370001.squirrel@www.fesb.hr> <49663.161.53.168.65.1222428487.squirrel@www.fesb.hr> <49550.161.53.168.65.1222672642.squirrel@www.fesb.hr> Date: Mon, 29 Sep 2008 10:29:45 +0200 (CEST) Subject: Re: CPU load From: kiki@fesb.hr To: "Albe Laurenz" Cc: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200809/256 X-Sequence-Number: 31569 Sorry, without LIMIT returns around 700000 rows. Tried to index date column and time column but the performance is pretty much the same. Everything is OK, I just don’t understand way is this query burdening the processor so much. Regards, Maja > kiki wrote: >> First I have increased shared_buffers from 2000 to 8000. Since the >> postgresql is on Debian I had to increase SHMMAX kernel value. >> Everything is working much faster now. > > Good to hear that the problem is gone. > >> There is still heavy load of postmaster process (up to 100%) for a >> simple >> query >> >> EXPLAIN ANALYSE SELECT * FROM system_alarm WHERE id_camera='3' AND >> confirmed='false' AND dismissed='false' ORDER BY date DESC, time DESC >> LIMIT 1; >> >> (the table is indexed by id_camera, has around 1 milion rows, and this >> query returns around 700000 rows and is executed (EXPLAIN ANALYSE) in >> around 4800 ms, and this table is queried a lot although not so often >> queried modified) >> >> but I don't think that is strange behavior of the postgresql. >> And it is exhibited all the time; the postgresql reset does not >> influence >> it at all. > > I'd expect a sequential scan for a query that returns 70% of the table. > > But I cannot believe that this query returns more than one row since > it has a "LIMIT 1". Can you enlighten me? > > In the above query (with LIMIT 1), maybe an index on "date" could help. > > Yours, > Laurenz Albe > > > -- > Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance >