Re: Big table - using wrong index - why?

From: "Joe Conway" <joseph(dot)conway(at)home(dot)com>
To: "Chris Ruprecht" <chrup999(at)yahoo(dot)com>, "pgsql" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Big table - using wrong index - why?
Date: 2001-07-30 16:43:09
Message-ID: 01d501c11916$b81603f0$48d210ac@jecw2k1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> phones=# \d i_pl_pseq
> Index "i_pl_pseq"
> Attribute | Type
> -----------+----------------------
> entity | character varying(3)
> pseq | bigint
> btree
>
> phones=# explain select * from phonelog where entity = '001' and pseq >=
> 9120 and pseq <= 9123;
> NOTICE: QUERY PLAN:
>
> Index Scan using i_pl_loadtimestamp on phonelog (cost=0.00..209247.39
> rows=607 width=137)
>
> EXPLAIN
>
> phones=# \d i_pl_loadtimestamp
> Index "i_pl_loadtimestamp"
> Attribute | Type
> -----------+----------------------
> entity | character varying(3)
> loaddate | date
> loadtime | time
> btree

Just a guess, but what happens if you build i_pl_pseq(pseq, entity), i.e.
reverse the key fields? Also, has the table been vacuum analyzed?

-- Joe

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2001-07-30 16:56:30 Re: Why does this plpgslq always return 1?
Previous Message Chris Ruprecht 2001-07-30 16:20:51 Big table - using wrong index - why?