pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Madison Kelly <linux@alteeve.com>
To: pgsql-performance@postgresql.org
Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: tgl@sss.pgh.pa.us
Cc: tobias@nordicbet.com
Subject: Re: Index ot being used
Date: Mon, 13 Jun 2005 13:57:31 -0400
Message-ID: <42ADC90B.4040808@alteeve.com> (raw)
In-Reply-To: <s2ad532e.099@gwmta.wicourts.gov>
References: <s2ad532e.099@gwmta.wicourts.gov>

Kevin Grittner wrote:
>>tle-bu=> \d file_info_7_display_idx
>>  Index "public.file_info_7_display_idx"
>>      Column      |         Type
>>-----------------+----------------------
>>  file_type       | character varying(2)
>>  file_parent_dir | text
>>  file_name       | text
>>btree, for table "public.file_info_7"
> 
> 
> The index is fine, but you need to phrase the query as
> 
> 	... ORDER BY file_type, file_parent_dir, file_name;
> 
> (Whether you use ASC or not doesn't matter.)  Otherwise the planner
> won't make the connection to the sort ordering of the index.
> 
> 			regards, tom lane

With Bruno's help I've gone back and tried just this with no luck. I've 
re-written the query to include all three items in the 'ORDER BY...' 
column in the same order but the sort still takes a long time and a 
sequential scan is being done instead of using the index.

For what it's worth, and being somewhat of a n00b, I agree with the idea 
of a smarter, more flexible planner. I guess the trade off is the added 
overhead neaded versus the size of the average query.

Madison

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Madison Kelly (Digimer)
TLE-BU, The Linux Experience; Back Up
http://tle-bu.thelinuxexperience.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



view thread (31+ messages)  latest in thread

Message-ID: <42ADC90B.4040808@alteeve.com>
Permalink:  ../42ADC90B.4040808@alteeve.com/
Also on:    postgresql.org/message-id/42ADC90B.4040808@alteeve.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: linux@alteeve.com, Kevin.Grittner@wicourts.gov, tgl@sss.pgh.pa.us, tobias@nordicbet.com
  Subject: Re: Index ot being used
  In-Reply-To: <42ADC90B.4040808@alteeve.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox