Re: Lack of use of indexes - Mailing list pgsql-general

From Tom Lane
Subject Re: Lack of use of indexes
Date
Msg-id 25445.1037986265@sss.pgh.pa.us
Whole thread Raw
In response to Re: Lack of use of indexes  (Don Isgitt <djisgitt@soundenergy.com>)
List pgsql-general
Don Isgitt <djisgitt@soundenergy.com> writes:
> gds2=# explain select * from lg where section=14;
> NOTICE:  QUERY PLAN:

> Seq Scan on lg  (cost=0.00..5885.77 rows=3836 width=73)

> EXPLAIN
> gds2=# set enable_seqscan=off;
> SET VARIABLE
> gds2=# explain select * from lg where section=14;
> NOTICE:  QUERY PLAN:

> Index Scan using lgsec on lg  (cost=0.00..12167.45 rows=3836 width=73)

> EXPLAIN

Of course, the above only proves that the planner thinks the indexscan
will be slower ;-).  You should try EXPLAIN ANALYZE to see how well the
planner estimates square up with reality ...

            regards, tom lane

pgsql-general by date:

Previous
From: Don Isgitt
Date:
Subject: Re: Lack of use of indexes
Next
From: Jon Swinth
Date:
Subject: Unwanted Log Entries