Re: Index usage question

Поиск
Список
Период
Сортировка
От Ryan Mahoney
Тема Re: Index usage question
Дата
Msg-id 5.0.2.1.0.20010904193051.03c75c60@paymentalliance.net
обсуждение исходный текст
Ответ на Re: Index usage question  ("Norbert Zoltan Toth" <Norbert.Zoltan.Toth@cern.ch>)
Список pgsql-general
What does your data look like?  If you have a lot of duplicate id's, a
sequential scan may be better than an index scan.
If you are not sure if this is the case, try:

SELECT id, count(*) AS count FROM test GROUP BY id ORDER BY count DESC
LIMIT 50;

This should show you the top 50 most duplicated records in your table.

-r

At 08:52 PM 9/4/01 +0200, Norbert Zoltan Toth wrote:

>I have experienced the following problem, maybe they are related:
>
>I create a table with
>     create table test (id int, name char(10));
>
>then I create an index on it with
>     create index test_idx on test (id);
>
>After populating my table, the query
>     select id from test where id='1';
>
>uses index scan.
>
>However when I only create the index AFTER inserting rows into the table,
>the index is not being used for the evaluation,
>even if I run vacuum / vaccum analyze on test;
>
>I would also appreciate some help with this.
>
>Thank you,
>Norbert
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://www.postgresql.org/search.mpl
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.251 / Virus Database: 124 - Release Date: 4/26/01

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.251 / Virus Database: 124 - Release Date: 4/26/01

В списке pgsql-general по дате отправления:

Предыдущее
От: Evan Zane Macosko
Дата:
Сообщение: data storage question
Следующее
От: "Mihai Gheorghiu"
Дата:
Сообщение: CREATE USER vs. createuser