pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Index not used on a DISTINCT ON
2+ messages / 2 participants
[nested] [flat]

* Index not used on a DISTINCT ON
@ 2003-03-21 10:07  Gaetano Mendola <mendola@bigfoot.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Gaetano Mendola @ 2003-03-21 10:07 UTC (permalink / raw)
  To: pgsql-admin

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 ?










^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Index not used on a DISTINCT ON
@ 2003-03-22 01:50  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Gaetano Mendola <mendola@bigfoot.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2003-03-22 01:50 UTC (permalink / raw)
  To: Gaetano Mendola <mendola@bigfoot.com>; +Cc: pgsql-admin

"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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-03-22 01:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-03-21 10:07 Index not used on a DISTINCT ON Gaetano Mendola <mendola@bigfoot.com>
2003-03-22 01:50 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox