Re: [PERFORM] select distinct uses index scan vs full table scan

2011-12-13 Thread Jon Nelson
On Tue, Dec 13, 2011 at 1:57 PM, Tom Lane wrote: > Jon Nelson writes: >> I've got a 5GB table with about 12 million rows. >> Recently, I had to select the distinct values from just one column. >> The planner chose an index scan. The query took almost an hour. >> When I forced index scan off, the

Re: [PERFORM] select distinct uses index scan vs full table scan

2011-12-13 Thread Tom Lane
Jon Nelson writes: > I've got a 5GB table with about 12 million rows. > Recently, I had to select the distinct values from just one column. > The planner chose an index scan. The query took almost an hour. > When I forced index scan off, the query took 90 seconds (full table scan). Usually, we he

[PERFORM] select distinct uses index scan vs full table scan

2011-12-13 Thread Jon Nelson
I've got a 5GB table with about 12 million rows. Recently, I had to select the distinct values from just one column. The planner chose an index scan. The query took almost an hour. When I forced index scan off, the query took 90 seconds (full table scan). The planner estimated 70,000 unique values