Skip site navigation (1) Skip section navigation (2)

getting an index to work with partial indices ...

From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: getting an index to work with partial indices ...
Date: 2005-08-29 19:56:15
Message-ID: 20050829165335.X1044@ganymede.hub.org (view raw or flat)
Thread:
Lists: pgsql-performance
Try as I might, I can't seem to get it to work ... table has >9million 
rows in it, I've created an index "using btree ( priority ) where priority 
< 0;", where the table distribution looks like:

  priority |  count
----------+---------
        -2 |  138435
        -1 |  943250
         1 |    3416
         9 | 1134171
           | 7276960
(5 rows)

And it still won't use the index:

# explain update table set priority = -3 where priority = -1;
                             QUERY PLAN 
------------------------------------------------------------------
  Seq Scan on table  (cost=0.00..400735.90 rows=993939 width=278)
    Filter: (priority = -1)
(2 rows)

But, ti will if I try 'priority = -2' ... what is teh threshhold for using 
the index?  obviously 10% of the records is too high ...

thanks ...

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy(at)hub(dot)org           Yahoo!: yscrappy              ICQ: 7615664

Responses

pgsql-performance by date

Next:From: Thomas F. O'ConnellDate: 2005-08-29 20:15:21
Subject: Re: Need indexes on empty tables for good performance ?
Previous:From: Merlin MoncureDate: 2005-08-29 18:41:46
Subject: Re: Limit + group + join

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group