From: | Jeong Jaeick, 정재익 <advance(at)advance(dot)sarang(dot)net> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Question about indexing! |
Date: | 2001-10-02 19:09:27 |
Message-ID: | 20011003040927.A27380@database.sarang.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
pgsql_bbs table has about 15,000 rows!
And almost of them are satify (topic='qna' and deleted<2) condition.
This explain result have a large cost.
I want to low this query cost.
Thanks for your concern :-)
>> select * from pgsql_bbs where topic = 'qna' and deleted < 2
>> order by gid desc, pos asc limit 20, 0;
>>
>> But this query is not using index!
>>
>> The next is result of explain of this query:
>>
>> dsn=# explain select * from pgsql_bbs where topic = 'qna' and deleted < 2
>> dsn-# order by gid desc, pos asc limit 20, 0;
>> NOTICE: QUERY PLAN:
>>
>> Limit (cost=15.71..15.71 rows=11 width=245)
>> -> Sort (cost=15.71..15.71 rows=11 width=245)
>> -> Index Scan using pgsql_topic_deleted on pgsql_bbs (cost=0.00..15.51 rows=11 widt
>h=245)
>
>It appears to be using the topic_deleted index according to this
>explain output.
>How many rows actually have topic='qna' and deleted<2?
--
====================================================
mailto:advance(at)advance(dot)sarang(dot)net
http://database.sarang.net
Dept of Neurosurgery, Dong-eui Medical Center
====================================================
From | Date | Subject | |
---|---|---|---|
Next Message | Esteban Gutierrez Abarzua | 2001-10-02 23:42:39 | jdbc driver |
Previous Message | Tom Lane | 2001-10-02 17:59:26 | Re: aggregate functions, COUNT |