Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 5B73C2E031C for ; Wed, 28 Nov 2007 18:24:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 12152-02 for ; Wed, 28 Nov 2007 18:24:33 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 383052E02BB for ; Wed, 28 Nov 2007 18:24:32 -0400 (AST) 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 lASMOOLF024968; Wed, 28 Nov 2007 17:24:24 -0500 (EST) To: cluster cc: "Steinar H. Gunderson" , pgsql-performance@postgresql.org Subject: Re: Query only slow on first run In-reply-to: <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> <474DDA8F.3070801@amossen.dk> Comments: In-reply-to cluster message dated "Wed, 28 Nov 2007 22:15:59 +0100" Date: Wed, 28 Nov 2007 17:24:24 -0500 Message-ID: <24967.1196288664@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/367 X-Sequence-Number: 27782 cluster writes: > 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. Buy a faster disk? You're essentially asking for a random sample of data that is not currently in memory. You're not going to get that without some I/O. regards, tom lane