Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 310782E0186 for ; Wed, 28 Nov 2007 17:17:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 55600-06 for ; Wed, 28 Nov 2007 17:17:51 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id B8CB22E0174 for ; Wed, 28 Nov 2007 17:17:55 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.1/8.14.1) with ESMTP id lASLHqSM088796 for ; Wed, 28 Nov 2007 17:17:52 -0400 (AST) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.1/8.14.1/Submit) id lASLFvr0088540 for pgsql-performance@postgresql.org; Wed, 28 Nov 2007 17:15:57 -0400 (AST) (envelope-from news) From: cluster X-Newsgroups: pgsql.performance Subject: Re: Query only slow on first run Date: Wed, 28 Nov 2007 22:15:59 +0100 Organization: Hub.Org Networking Services Lines: 11 Message-ID: <474DDA8F.3070801@amossen.dk> References: <20071127165543.GY11978@crankycanuck.ca> <23999.1196184368@sss.pgh.pa.us> <056501c83128$55d58a90$8e00a8c0@tridecap.com> <20071127233833.GA24031@uio.no> <15029.1196209554@sss.pgh.pa.us> <474CBF98.6070508@amossen.dk> <20071128203442.GB30600@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: "Steinar H. Gunderson" User-Agent: Thunderbird 2.0.0.6 (X11/20071022) In-Reply-To: <20071128203442.GB30600@uio.no> To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/365 X-Sequence-Number: 27780 > The indexes don't contain visibility information, so Postgres has to look up > the row on disk to verify it isn't dead. I guess this fact drastically decreases the performance. :-( The number of rows with a random_number will just grow over time while the number of questions with status = 1 will always be somewhat constant at about 10.000 or most likely much less. I could really use any kind of suggestion on how to improve the query in order to make it scale better for large data sets The 6-7000 ms for a clean run is really a showstopper. Need to get it below 70 ms somehow.