pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Palle Girgensohn <girgen@pingpong.net>
To: pgsql-performance@postgresql.org
Subject: Re: avoiding seqscan?
Date: Sun, 28 Sep 2003 14:34:25 -0700
Message-ID: <200309281434.25881.josh@agliodbs.com> (raw)
In-Reply-To: <95900000.1064782481@palle.girgensohn.se>
References: <95900000.1064782481@palle.girgensohn.se>

Palle,

> I have a SQL statement that I cannot get to use the index. postgresql
> insists on using a seqscan and performance is very poor. set enable_seqscan
> = true boost performance drastically, as you can see below. Since seqscan
> is not always bad, I'd rather not turn it off completely, but rather get
> the planner to do the right thing here. Is there another way to do this,
> apart from setting enable_seqscan=false?

In your postgresql.conf, try setting effective_cache_size to something like 
50% of your system's RAM, and lovering random_page_cost to 2.0 or even 1.5.  
Then restart PostgreSQL and try your query again.

What version, btw?


-- 
Josh Berkus
Aglio Database Solutions
San Francisco



view thread (11+ messages)  latest in thread

Message-ID: <200309281434.25881.josh@agliodbs.com>
Permalink:  ../200309281434.25881.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200309281434.25881.josh@agliodbs.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: josh@agliodbs.com, girgen@pingpong.net
  Subject: Re: avoiding seqscan?
  In-Reply-To: <200309281434.25881.josh@agliodbs.com>
  References: <95900000.1064782481@palle.girgensohn.se> <200309281434.25881.josh@agliodbs.com>

* 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