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

From: johnmudd <johnbmudd(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Just trying to read first row in table based on index, pg scans and sorts instead?
Date: 2012-04-19 22:58:19
Message-ID: 1334876299280-5652991.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Steve Crawford 2012-04-19 23:31:48 Re: Re: Just trying to read first row in table based on index, pg scans and sorts instead?
Previous Message Tom Lane 2012-04-19 22:11:44 Re: Just trying to read first row in table based on index, pg scans and sorts instead?