pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A.Bhuvaneswaran <bhuvan@symonds.net>
To: pgsql-admin@postgresql.org
Subject: Index is not used
Date: Sat, 20 Dec 2003 09:58:35 +0530
Message-ID: <1071894514.1380.1.camel@Bhuvan.bksys.co.in> (raw)

Hi,

I am using pgsql 7.3.4 on rh7.3.

I have a table and an index on it. The index is used when i use '='
operator for the indexed field in the where condition. But the index is
not used when i use '>=' operator for the same field. Herewith i have
attached the explain output. Hope to get some lights.

regards,
bhuvaneswaran

Attachments:

explain.txt (text/plain, 3.1K) download => SELECT version(); version ----------------------------------------------------------------- PostgreSQL 7.3.4 on i386-redhat-linux-gnu, compiled by GCC 2.96 (1 row) => EXPLAIN select distinct comp_code, supp_code, supp_name, buyer_code, buyer_name, item_code, revision, description, po_no, pos_no, order_date, delivery_date, reschedule_date, reschedule_qty, ordered_qty, delivered_qty, backorder_qty, stock, warehouse_code, allocated, exception, run_date from reschedule_bak where order_date = '01/04/2003'; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Unique (cost=6999.59..7123.48 rows=215 width=213) -> Sort (cost=6999.59..7004.98 rows=2155 width=213) Sort Key: comp_code, supp_code, supp_name, buyer_code, buyer_name, item_code, revision, description, po_no, pos_no, order_date, delivery_date, reschedule_date, reschedule_qty, ordered_qty, delivered_qty, backorder_qty, stock, warehouse_code, allocated, exception, run_date -> Index Scan using reschedule_bak_order_date_idx on reschedule_bak (cost=0.00..6880.30 rows=2155 width=213) Index Cond: (order_date = '01/04/2003'::date) (5 rows) => EXPLAIN select distinct comp_code, supp_code, supp_name, buyer_code, buyer_name, item_code, revision, description, po_no, pos_no, order_date, delivery_date, reschedule_date, reschedule_qty, ordered_qty, delivered_qty, backorder_qty, stock, warehouse_code, allocated, exception, run_date from reschedule_bak where order_date >= '01/04/2003'; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Unique (cost=160596.18..179932.81 rows=33629 width=213) -> Sort (cost=160596.18..161436.90 rows=336289 width=213) Sort Key: comp_code, supp_code, supp_name, buyer_code, buyer_name, item_code, revision, description, po_no, pos_no, order_date, delivery_date, reschedule_date, reschedule_qty, ordered_qty, delivered_qty, backorder_qty, stock, warehouse_code, allocated, exception, run_date -> Seq Scan on reschedule_bak (cost=0.00..88532.21 rows=336289 width=213) Filter: (order_date >= '01/04/2003'::date) (5 rows)
signature.asc (application/pgp-signature, 231B) download

view thread (5+ messages)  latest in thread

Message-ID: <1071894514.1380.1.camel@Bhuvan.bksys.co.in>
Permalink:  ../1071894514.1380.1.camel@Bhuvan.bksys.co.in/
Also on:    postgresql.org/message-id/1071894514.1380.1.camel@Bhuvan.bksys.co.in

 · 

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-admin@postgresql.org
  Cc: bhuvan@symonds.net
  Subject: Re: Index is not used
  In-Reply-To: <1071894514.1380.1.camel@Bhuvan.bksys.co.in>
  References: <1071894514.1380.1.camel@Bhuvan.bksys.co.in>

* 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