pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <kgrittn@ymail.com>
To: Mark Rotteveel <mark@lawinegevaar.nl>
To: PostgreSQL JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: Regarding inclusion of indexes as tables
Date: Sat, 9 May 2015 15:15:01 +0000 (UTC)
Message-ID: <1613283179.3261220.1431184501200.JavaMail.yahoo@mail.yahoo.com> (raw)
In-Reply-To: <554DBE8F.2030709@lawinegevaar.nl>
References: <554DBE8F.2030709@lawinegevaar.nl>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Mark Rotteveel <mark@lawinegevaar.nl> wrote:

> [...] having getTables and getColumns return index information
> sounds a bit curious: that is what getIndexInfo is for.
> Is an index in PostgreSQL selectable (as if it is a table) or can
> the index itself be referenced as a column (eg select index from
> table)? If not, I'd suggest that the information should not be
> part of getTables nor of getColumns.

It's somewhat understandable how the driver developers got to this
point, since in the server indexes are considered *relations*, as
are tables, views, materialized views, system catalogs, foreign
tables, etc.  On the other hand, unlike other relations they cannot
generally be referenced in SELECT queries or DML statements.  A
query can sometimes return data directly from the columns in an
index, but it is the job of the optimizer to recognize when a query
referencing a table can be optimized in this way.

If I were designing this in a green field, I would probably limit
return of indexes to the getIndexInfo() method and filter them out
of scans of relations returned by the getTables() method.  That
said, doing so now could break working code for existing users, and
the getTables() method does allow you to specify which table types
you want returned; so I (and probably most of the pg community)
would be reluctant to support filtering them out by default at this
point.  We tend to be reluctant to make changes that break working
code for existing users, and want to make a lot of noise about any
such change so that people have a chance to fix it before putting
it into production.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (6+ messages)  latest in thread

Message-ID: <1613283179.3261220.1431184501200.JavaMail.yahoo@mail.yahoo.com>
Permalink:  ../1613283179.3261220.1431184501200.JavaMail.yahoo@mail.yahoo.com/
Also on:    postgresql.org/message-id/1613283179.3261220.1431184501200.JavaMail.yahoo@mail.yahoo.com

 · 

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-jdbc@postgresql.org
  Cc: kgrittn@ymail.com, mark@lawinegevaar.nl
  Subject: Re: Regarding inclusion of indexes as tables
  In-Reply-To: <1613283179.3261220.1431184501200.JavaMail.yahoo@mail.yahoo.com>
  References: <554DBE8F.2030709@lawinegevaar.nl> <1613283179.3261220.1431184501200.JavaMail.yahoo@mail.yahoo.com>

* 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