Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 074F99FBEBD for ; Wed, 20 Jun 2007 12:10:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 94673-08-3 for ; Wed, 20 Jun 2007 12:10:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D67449FBECA for ; Wed, 20 Jun 2007 12:09:59 -0300 (ADT) 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 l5KF9vsW017908; Wed, 20 Jun 2007 11:09:57 -0400 (EDT) To: "Mikko Partio" cc: pgsql-performance@postgresql.org Subject: Re: Slow indexscan In-reply-to: <2ca799770706200702y1074f066s61279b67f93315d0@mail.gmail.com> References: <2ca799770706200702y1074f066s61279b67f93315d0@mail.gmail.com> Comments: In-reply-to "Mikko Partio" message dated "Wed, 20 Jun 2007 17:02:25 +0300" Date: Wed, 20 Jun 2007 11:09:57 -0400 Message-ID: <17907.1182352197@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/418 X-Sequence-Number: 25451 "Mikko Partio" writes: > Index Scan using tbl_20070601_pkey on tbl_20070601 t1 > (cost=0.00..365.13rows=13 width=137) (actual time= > 120.83..10752.64 rows=539 loops=1) > Index Cond: ((validtime >= 20070602000000::bigint) AND (validtime <= > 20070602235500::bigint) AND (latitude = 60.2744::double precision) AND > (longitude = 26.4417::double precision)) > Filter: (parname = 'temperature'::character varying) You do realize that's going to scan the entire index range from 20070602000000 to 20070602235500? If this is a typical query you'd be better off putting the lat/long columns first in the index. regards, tom lane