Re: Query uses incorrect index

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: pasman pasma*ski <pasman(dot)p(at)gmail(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Query uses incorrect index
Date: 2010-12-21 15:44:15
Message-ID: 4D1076EF020000250003888E@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

pasman pasma*ski<pasman(dot)p(at)gmail(dot)com> wrote:

> -> Index Scan using NTA_5" on "NumeryA" a
> (cost=0.01..10016.75 rows=24175 width=42) (actual
> time=0.132..308.018 rows=33597 loops=1)"

> seq_page_cost = 0.3
> random_page_cost = 0.5

Your data is heavily cached (to be able to read 33597 rows randomly
through an index in 308 ms), yet you're telling the optimizer that a
random access is significantly more expensive than a sequential one.
Try this in your session before running the query (with all indexes
present):

set seq_page_cost = 0.1;
set random_page_cost = 0.1;

I don't know if the data for all your queries is so heavily cached
-- if so, you might want to change these settings in your
postgresql.conf file.

-Kevin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Pavel Stehule 2010-12-21 15:50:51 Re: MySQL HandlerSocket - Is this possible in PG?
Previous Message Michael Ben-Nes 2010-12-21 15:17:07 Re: MySQL HandlerSocket - Is this possible in PG?