Обсуждение: Index not used on a DISTINCT ON

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

Index not used on a DISTINCT ON

От
"Gaetano Mendola"
Дата:
Hi all,

I have a table with two column:   id_user and login;

and the column login is a Primary Key.

If I made the following view:
CREATE VIEW foo
    SELECT DISTINCT ON ( login )
        ul.id_login       AS login,
        ud.last_name  AS last_name,
    FROM user_login ul LEFT JOIN v_user_traffic v USING ( id_user)
                user_data ud
   WHERE  ul.id_user = ud.id_user;

when is used in this way:

    SELECT * FROM foo WHERE login = 'XXXXXX';

the index is not used if I remove the DISTINCT ON
the filter is used!!!

Is it a known issue ?








Re: Index not used on a DISTINCT ON

От
Tom Lane
Дата:
"Gaetano Mendola" <mendola@bigfoot.com> writes:
> the index is not used if I remove the DISTINCT ON
> the filter is used!!!
> Is it a known issue ?

Okay, okay already ;-)

This has been on my to-fix list for awhile.  It's fixed now for 7.4.

            regards, tom lane