Re: index and queries using '<' '>'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marc Boucher <pgml(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: index and queries using '<' '>'
Date: 2004-11-19 15:22:32
Message-ID: 28011.1100877752@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marc Boucher <pgml(at)gmx(dot)net> writes:
>> Index scans aren't always faster than sequential scans.

> I know that, but I've some comparisons with other queries. And someone
> advised me to try "set enable_seqscan=off;". It takes 50-60% (after
> checking right now) less to use the index. Unfortunately I can't use this
> setting, the query being part of a larger query (joins), and the time
> gained on this particular index is partially lost on the joins.

A less brute-force way of encouraging the planner to use indexscans is
to reduce the random_page_cost setting. It defaults to 4 but many
people find that values nearer 2 are more representative of what happens
in their environments.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-11-19 15:42:11 Re: Phantom user in db--'128'
Previous Message Stephan Szabo 2004-11-19 15:20:50 Re: index and queries using '<' '>'