Please CC the list as well as replying directly to me. I don't read this
email address often.
Mihail Nasedkin wrote:
>
> RH> Why do you want an index scan? Do you have any evidence it will be
> RH> faster than a sequential scan?
>
> No, but I want to be ready for make Index scan queries in future. I
> make first steps on the customize SQL.
PostgreSQL uses statistics on what values are in what columns to decide
how to plan a query. So - if you are asking for all rows from a table it probably won't use an index because it knows
youwill have to read the
whole table anyway.
> Where I can read more about optimize the SQL-queries and about
> differences between types of scan?
Well, perhaps the best place to learn more is the performance mailing
list. You can see plenty of real-world problems being discussed there.
Two sections of the manual you should read are Chapter 13. Performance Tips Chapter 23. Monitoring Database Activity
Understanding how to read EXPLAIN ANALYSE output and manage statistics
are vital.
Finally, details on configuration settings can be found at: http://www.powerpostgresql.com/PerfListhttp://www.varlena.com/varlena/GeneralBits/Tidbits/index.php
-- Richard Huxton Archonet Ltd