Re: [HACKERS] JOIN between three *simple* tables ...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] JOIN between three *simple* tables ...
Дата
Msg-id 8775.1013030073@sss.pgh.pa.us
обсуждение исходный текст
Ответ на JOIN between three *simple* tables ...  ("Marc G. Fournier" <scrappy@hub.org>)
Ответы Re: [HACKERS] JOIN between three *simple* tables ...  ("Marc G. Fournier" <scrappy@hub.org>)
Список pgsql-sql
"Marc G. Fournier" <scrappy@hub.org> writes:
> iwantu=# \d poc_uid
>  Index "poc_uid"
>  Column |  Type
> --------+--------
>  uid    | bigint
> btree

> iwantu=# explain select count(1) from orientation_c poc where uid = 1;
> NOTICE:  QUERY PLAN:

> Aggregate  (cost=2264.97..2264.97 rows=1 width=0)
>   ->  Seq Scan on orientation_c poc  (cost=0.00..2264.96 rows=1 width=0)

> EXPLAIN

You're forgetting ye olde constant-casting problem.  You need something
like
select count(1) from orientation_c poc where uid = 1::bigint;

to use an index on a bigint column.

Not sure about the other thing; have you VACUUM ANALYZEd (or at least
ANALYZEd) since filling the tables?  It looks like the system thinks
the tables are much smaller than they really are.
        regards, tom lane


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

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: JOIN between three *simple* tables ...
Следующее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: [HACKERS] JOIN between three *simple* tables ...