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
=> 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)

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to