Re: test / live environment, major performance difference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jun 12, 2007, at 8:32 , Christo Du Preez wrote:

I have noticed that my server never uses indexing. No matter what I do.

As an example I took a table with about 650 rows, having a parentid
field with an index on parentid.

EXPLAIN ANALYZE
SELECT *
  FROM layertype
where parentid = 300;

The planner weighs the cost of the different access methods and choses the one that it believes is lowest in cost. An index scan is not always faster than a sequential scan. With so few rows, it's probably faster for the server to read the whole table rather than reading the index and looking up the corresponding row. If you want to test this, you can set enable_seqscan to false and try running your query again.

http://www.postgresql.org/docs/8.2/interactive/runtime-config- query.html#RUNTIME-CONFIG-QUERY-ENABLE

Michael Glaesemann
grzm seespotcode net




[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux