Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 094F8633D02 for ; Fri, 1 Jan 2010 11:05:06 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 59521-08 for ; Fri, 1 Jan 2010 15:04:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from shrek.krogh.cc (2605ds1-ynoe.0.fullrate.dk [90.184.12.24]) by mail.postgresql.org (Postfix) with ESMTP id 69F5F63265C for ; Fri, 1 Jan 2010 11:04:55 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by shrek.krogh.cc (Postfix) with ESMTP id AA3BD1C5562; Fri, 1 Jan 2010 16:04:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at shrek.krogh.cc Received: from shrek.krogh.cc ([127.0.0.1]) by localhost (shrek.krogh.cc [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nqeundKe6Jp9; Fri, 1 Jan 2010 16:04:49 +0100 (CET) Received: from [90.184.13.137] (unknown [90.184.13.137]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jesper@krogh.cc) by shrek.krogh.cc (Postfix) with ESMTPSA id 1E5801C554A; Fri, 1 Jan 2010 16:04:49 +0100 (CET) Message-ID: <4B3E0F15.5070706@krogh.cc> Date: Fri, 01 Jan 2010 16:04:53 +0100 From: Jesper Krogh User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Greg Williamson CC: pgsql-performance@postgresql.org Subject: Re: Message queue table - strange performance drop with changing limit size. References: <4B3DE11B.1010708@krogh.cc> <99179.26367.qm@web46102.mail.sp1.yahoo.com> In-Reply-To: <99179.26367.qm@web46102.mail.sp1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/3 X-Sequence-Number: 36883 Greg Williamson wrote: > Jesper -- > > I apologize for top-quoting -- a challenged reader. > > This doesn't directly address your question, but I can't help but > notice that the estimates for rows is _wildly_ off the actual number > in each and every query. How often / recently have you run ANALYZE on > this table ? It is actually rather accurate, what you see in the explain analyze is the "limit" number getting in.. where the inner "rows" estiemate is for the where clause+filter. > Are the timing results consistent over several runs ? It is possible > that caching effects are entering into the time results. Yes, they are very consistent. It have subsequently found out that it depends on the amount of "workers" doing it in parallel. I seem to top at around 12 processes. I think I need to rewrite the message-queue stuff in a way that can take advantage of some stored procedures instead. Currenly it picks out the "top X" randomize it in the client picks one and tries to "grab" it. .. and over again if it fails. When the select top X begins to consume signifcant time it self the process bites itself and gradually gets worse. The workload for the individual jobs are "small". ~1-2s. -- Jesper