Re: [GENERAL] Problem with index not always being used

2007-02-17 Thread Rob Tester
Thanks for the thoughts, certainly I will look into what you have explained. However, the behavior that you expressed isn't what is occuring. In the 12, 16 example 12 does have more rows than 16. However, there are many cases when this isn't true, that is other states have more rows than 12 and th

Re: [GENERAL] Problem with index not always being used

2007-02-17 Thread Tom Lane
"Rob Tester" <[EMAIL PROTECTED]> writes: > SELECT * FROM STUFF WHERE state=12; --causes a seq scan of the table > where > SELECT * FROM STUFF WHERE state=16 --Uses the index. This behavior is intended and appropriate, if there are lots of rows with state=12 and not many with state=16. As an ex

Re: [GENERAL] Problem with index not always being used

2007-02-17 Thread Rob Tester
I am using pg 8.1.4, I have a table with 1.1 million rows of data (see below for table definition). One field state is numeric and has an index. The index is not always picked up when searching the table by state only and I can't figure out why. So: SELECT * FROM STUFF WHERE state=12; --causes