pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Glaesemann <grzm@seespotcode.net>
To: Christo Du Preez <christo@mecola.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: test / live environment, major performance difference
Date: Tue, 12 Jun 2007 08:47:05 -0500
Message-ID: <6336D034-24D7-47B3-8690-9E7561E5432C@seespotcode.net> (raw)
In-Reply-To: <466EA078.20601@mecola.com>
References: <466EA078.20601@mecola.com>


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





view thread (20+ messages)  latest in thread

Message-ID: <6336D034-24D7-47B3-8690-9E7561E5432C@seespotcode.net>
Permalink:  ../6336D034-24D7-47B3-8690-9E7561E5432C@seespotcode.net/
Also on:    postgresql.org/message-id/6336D034-24D7-47B3-8690-9E7561E5432C@seespotcode.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: grzm@seespotcode.net, christo@mecola.com
  Subject: Re: test / live environment, major performance difference
  In-Reply-To: <6336D034-24D7-47B3-8690-9E7561E5432C@seespotcode.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox