pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gaetano Mendola <mendola@bigfoot.com>
To: pgsql-admin@postgresql.org
Subject: Index not used on a DISTINCT ON
Date: Fri, 21 Mar 2003 11:07:22 +0100
Message-ID: <b5eo8g$834$1@news.hub.org> (raw)

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 ?










view thread (2+ messages)  latest in thread

Message-ID: <b5eo8g$834$1@news.hub.org>
Permalink:  ../b5eo8g$834$1@news.hub.org/
Also on:    postgresql.org/message-id/b5eo8g$834$1@news.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mendola@bigfoot.com
  Subject: Re: Index not used on a DISTINCT ON
  In-Reply-To: <b5eo8g$834$1@news.hub.org>
  References: <b5eo8g$834$1@news.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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