pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeong Jaeick, Á¤ÀçÀÍ <advance@advance.sarang.net>
To: pgsql-sql@postgresql.org
Subject: Re: Question about indexing!
Date: Wed, 3 Oct 2001 04:09:27 +0900
Message-ID: <20011003040927.A27380@database.sarang.net> (raw)

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@advance.sarang.net
http://database.sarang.net
Dept of Neurosurgery, Dong-eui Medical Center
====================================================



view thread (4+ messages)  latest in thread

Message-ID: <20011003040927.A27380@database.sarang.net>
Permalink:  ../20011003040927.A27380@database.sarang.net/
Also on:    postgresql.org/message-id/20011003040927.A27380@database.sarang.net

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: advance@advance.sarang.net
  Subject: Re: Question about indexing!
  In-Reply-To: <20011003040927.A27380@database.sarang.net>

* 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