Forcing using index instead of sequential scan?

From: <robin(dot)c(dot)smith(at)bt(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Forcing using index instead of sequential scan?
Date: 2006-07-21 10:40:33
Message-ID: D012B9600FFB984AB18C0D53C475A4A081F51B@E03MVZ3-UKDY.domain1.systemhost.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I have been testing the performance of PostgreSQL using the simple tool
found at http://benchw.sourceforge.net however I have found that all the
queries it run execute with sequential scans. The website where the code
runs has examples of the execution plan using indexes.

When I disable the sequential plan query 0 and query 1 run faster (
http://benchw.sourceforge.net/benchw_results_postgres_history.html ) by
using the indexes as suggested by the website.

I have tried increasing the effective_cache_size and reducing the
random_page_cost to try and force the optimiser to use the index but it
always uses the sequential scan.

What is the best way to force the use of indexes in these queries?
Currently testing with version 8.1.4.

Regards

Robin Smith

British Telecommunications plc Registered office: 81 Newgate Street
London EC1A 7AJ

Registered in England no. 1800000

This electronic message contains information from British
Telecommunications plc which may be privileged and confidential. The
information is intended to be for the use of the individual(s) or entity
named above. If you are not the intended recipient, be aware that any
disclosure, copying, distribution or use of the contents of this
information is prohibited. If you have received this electronic message
in error, please notify us by telephone or e-mail (to the number or
address above) immediately.

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Peter Eisentraut 2006-07-21 11:45:41 Re: Forcing using index instead of sequential scan?
Previous Message Robert Lor 2006-07-21 07:56:56 Re: Sun Donated a Sun Fire T2000 to the PostgreSQL