Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 3D59B9FC0A9 for ; Fri, 20 Jul 2007 13:42:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 22307-09 for ; Fri, 20 Jul 2007 13:42:08 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EF2A29FB45E for ; Fri, 20 Jul 2007 13:42:07 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l6KGg5jD010728; Fri, 20 Jul 2007 12:42:05 -0400 (EDT) To: Dan Harris cc: PostgreSQL Performance Subject: Re: Simple query showing 270 hours of CPU time In-reply-to: <46A0D836.5090806@drivefaster.net> References: <46A0D836.5090806@drivefaster.net> Comments: In-reply-to Dan Harris message dated "Fri, 20 Jul 2007 09:43:50 -0600" Date: Fri, 20 Jul 2007 12:42:05 -0400 Message-ID: <10727.1184949725@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/260 X-Sequence-Number: 25944 Dan Harris writes: > Here's the strace summary as run for a few second sample: > % time seconds usecs/call calls errors syscall > ------ ----------- ----------- --------- --------- ---------------- > 97.25 0.671629 92 7272 semop > 1.76 0.012171 406 30 recvfrom > 0.57 0.003960 66 60 gettimeofday > 0.36 0.002512 28 90 sendto > 0.05 0.000317 10 32 lseek > 0.01 0.000049 1 48 select > ------ ----------- ----------- --------- --------- ---------------- > 100.00 0.690638 7532 total > Here's the query: > select id from eventkeywords where word = '00003322' How sure are you that (a) that's really what it's doing and (b) you are not observing multiple executions of the query? There are no recvfrom calls in the inner loops of the backend AFAIR, so this looks to me like the execution of 30 different queries. The number of semops is distressingly high, but that's a contention issue not an amount-of-runtime issue. I think you're looking at a backend that has simply executed one heckuva lot of queries on behalf of its client, and that inquiring into what the client thinks it's doing might be the first order of business. regards, tom lane