X-Original-To: pgsql-performance@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 15934476149 for ; Tue, 4 Mar 2003 10:09:50 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 06483-08 for ; Tue, 4 Mar 2003 10:09:33 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 320D7475DBD for ; Tue, 4 Mar 2003 10:09:33 -0500 (EST) Received: from klaster.net (pc139.krakow.cvx.ppp.tpnet.pl [213.76.38.139]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 5C1C02B896; Tue, 4 Mar 2003 16:07:47 +0100 (CET) Message-ID: <3E64C1BF.4080704@klaster.net> Date: Tue, 04 Mar 2003 16:09:51 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; PL; rv:1.1) Gecko/20020826 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Paul McKay Cc: pgsql-performance@postgresql.org Subject: Re: Slow query performance on large table References: <000001c2e25c$ad506170$0c64a8c0@paulspc> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/6 X-Sequence-Number: 1304 Paul McKay wrote: > Hi, > > > > I am executing a query on a table: > > > > Table "public.measurement" > > Column | Type | Modifiers > > ------------+-----------------------+----------- > > assessment | integer | > > time | integer | > > value | character varying(50) | > > Indexes: idx_measurement_assessment btree (assessment), > > idx_measurement_time btree ("time") > > > > The primary key of the table is a combination of assessment and time, > and there are indexes on both assessment and time. > > > > The query I am executing is > > > > Select time,value > > From measurement > > Where assessment = ? > > And time between ? and ? Changing 2 indexes into one both-fields index should improve performance much. create index ind_meas on measurement (assessment,time). Regards, Tomasz Myrta