X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9A09ED1C9E7; Tue, 14 Oct 2003 16:59:47 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 42483-01; Tue, 14 Oct 2003 13:59:17 -0300 (ADT) Received: from mta3.snet.net (mta3.snet.net [204.60.203.69]) by svr1.postgresql.org (Postfix) with ESMTP id 0F468D1CA86; Tue, 14 Oct 2003 13:52:49 -0300 (ADT) Received: from [192.168.1.203] (167.95.252.64.snet.net [64.252.95.167]) by mta3.snet.net (8.12.3/8.12.3/SNET-smtp-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id h9EGqeIJ002426; Tue, 14 Oct 2003 12:52:41 -0400 (EDT) Date: Tue, 14 Oct 2003 12:48:06 -0400 (EDT) From: Wei Weng X-X-Sender: wweng@localhost.localdomain To: Christopher Kings-Lynne Cc: Chris Faulkner , Pgsql-Performance , Pgsql-Sql Subject: Re: [SQL] sql performance and cache In-Reply-To: <3F87D764.8030306@familyhealth.com.au> Message-ID: References: <3F87D764.8030306@familyhealth.com.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/464 X-Sequence-Number: 4212 On Sat, 11 Oct 2003, Christopher Kings-Lynne wrote: > > > I have two very similar queries which I need to execute. They both have > > exactly the same from / where conditions. When I execute the first, it takes > > about 16 seconds. The second is executed almost immediately after, it takes > > 13 seconds. In short, I'd like to know why the query result isn't being > > cached and any ideas on how to improve the execution. > > > > > OK - so I could execute the query once, and get the maximum size of the > > array and the result set in one. I know what I am doing is less than optimal > > but I had expected the query results to be cached. So the second execution > > would be very quick. So why aren't they ? I have increased my cache size - > > shared_buffers is 2000 and I have doubled the default max_fsm... settings > > (although I am not sure what they do). sort_mem is 8192. > > PostgreSQL does not have, and has never had a query cache - so nothing > you do is going to make that second query faster. > > Perhaps you are confusing it with the MySQL query cache? > > Chris > Is there plan on developing one (query cache)? Thanks Wei