pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedgetting an index to work with partial indices ...
2+ messages / 2 participants
[nested] [flat]
* getting an index to work with partial indices ...
@ 2005-08-29 19:56 Marc G. Fournier <scrappy@postgresql.org>
2005-08-29 20:19 ` Re: getting an index to work with partial indices ... Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Marc G. Fournier @ 2005-08-29 19:56 UTC (permalink / raw)
To: 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@hub.org Yahoo!: yscrappy ICQ: 7615664
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: getting an index to work with partial indices ...
2005-08-29 19:56 getting an index to work with partial indices ... Marc G. Fournier <scrappy@postgresql.org>
@ 2005-08-29 20:19 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2005-08-29 20:19 UTC (permalink / raw)
To: Marc G. Fournier <scrappy@postgresql.org>; +Cc: pgsql-performance
"Marc G. Fournier" <scrappy@postgresql.org> writes:
> But, ti will if I try 'priority = -2' ... what is teh threshhold for using
> the index? obviously 10% of the records is too high ...
Depends on a lot of factors, but usually somewhere between 1% and 10%.
(The new bitmap index scan code in 8.1 should be workable for higher
percentages.) If this doesn't seem to square with reality for you,
you might try reducing random_page_cost.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-08-29 20:19 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-08-29 19:56 getting an index to work with partial indices ... Marc G. Fournier <scrappy@postgresql.org>
2005-08-29 20:19 ` Tom Lane <tgl@sss.pgh.pa.us>
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