Обсуждение: Why index scan doesn't work ???

Поиск
Список
Период
Сортировка

Why index scan doesn't work ???

От
Tourtounis Sotiris
Дата:
Hello i have a question baout the functionality of index.Specifically, i
have table let say A(att0 int4, att1 int4, att2 int4) and i construct 2
indexes, one on att0 and one in att2 respectively. Afterwards i make an
insertion of tuples to that table through the 'copy A from ' a batch
file and after i run the command of vacuum verbose and finally i make the
following  SQL query:

select Y.att0 from class X, class Y where ((X.att0 = %d) and (X.att1 <= Y.att0) and (Y.att0 <= X.att0))

Theoretically both indexes should run on both class X and class Y. However
only the index on class X runs whether there is an execution of a
sequential scan to class Y. Please if anyone has any opinion or can notice
any mistake/fault that i have done to all those that i prereffered
previoysly is welcome to testify it. Thanks a priori !!!

PS: The postmaster is running with the amount of 1000 buffers as the
amount of the inserted tuples is about 1/4 of million.


                                                 SWTHRHS TOYRTOYNHS
                                                (tourtoun@csd.uch.gr)



Re: Why index scan doesn't work ???

От
Richard Huxton
Дата:
On Friday 23 Aug 2002 11:46 am, Tourtounis Sotiris wrote:
> Hello i have a question baout the functionality of index.
>
> select Y.att0 from class X, class Y where ((X.att0 = %d) and (X.att1 <=
> Y.att0) and (Y.att0 <= X.att0))

Run EXPLAIN ANALYSE SELECT .... and if the output doesn't make any sense post
it back here, then we'll be able to see.

See Ch11 of the user's guide for an explanation of EXPLAIN.

- Richard Huxton