Re: Just trying to read first row in table based on index, pg scans and sorts instead? - Mailing list pgsql-novice

From johnmudd
Subject Re: Just trying to read first row in table based on index, pg scans and sorts instead?
Date
Msg-id 1334876299280-5652991.post@n5.nabble.com
Whole thread Raw
In response to Re: Just trying to read first row in table based on index, pg scans and sorts instead?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: Just trying to read first row in table based on index, pg scans and sorts instead?  (Steve Crawford <scrawford@pinpointresearch.com>)
List pgsql-novice
Thanks, that fixed it! That's good news. The bad news is that I had made it a
rule to add the parens because a similar query would "ignore" the an index
if I left the parens off. I'll try to did up the counter example. It was for
a different table, index.


reports=> EXPLAIN ANALYZE SELECT * FROM rx ORDER BY storenbr,rxnbr,rfnbr
LIMIT 1;
                                                                     QUERY
PLAN

-----------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=0.00..0.68 rows=1 width=828) (actual time=0.018..0.018 rows=1
loops=1)
   ->  Index Scan using rx_storenbr_rxnbr_rfnbr_index2 on rx
(cost=0.00..125687.98 rows=185551 width=828) (actual time=0.016..0.016
rows=1 loops=1)
 Total runtime: 0.164 ms
(3 rows)

reports=>



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Just-trying-to-read-first-row-in-table-based-on-index-pg-scans-and-sorts-instead-tp5652859p5652991.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Just trying to read first row in table based on index, pg scans and sorts instead?
Next
From: Steve Crawford
Date:
Subject: Re: Re: Just trying to read first row in table based on index, pg scans and sorts instead?