pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Igor Neyman <ineyman@perceptron.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Michael Moore <michaeljmoore@gmail.com>
Cc: postgres list <pgsql-sql@postgresql.org>
Subject: Re: simple function index question
Date: Wed, 23 Mar 2016 16:30:18 +0000
Message-ID: <A76B25F2823E954C9E45E32FA49D70ECCD68075F@mail.corp.perceptron.com> (raw)
In-Reply-To: <CAKFQuwbeqMpTanF3h+Mbddot9-100Vj3KbkivAD47M4-VWEwfA@mail.gmail.com>
References: <CACpWLjPDmEqqu4DcuOPH_EfmrZPshW-aN9Wq+GBXOZf-ZvHrHA@mail.gmail.com>
	<CAFnxYwjm3BjTy6pLxL3DNSrovxbqAU5wVPzyp-JjfOc7Bv2DTw@mail.gmail.com>
	<CACpWLjPNQEUTc49OuWKA5U0qs7-cVmP1J_u_GECv-BS5Eciteg@mail.gmail.com>
	<A76B25F2823E954C9E45E32FA49D70ECCD68070C@mail.corp.perceptron.com>
	<CAKFQuwbeqMpTanF3h+Mbddot9-100Vj3KbkivAD47M4-VWEwfA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Interestingly a version of this:

CREATE INDEX TX_QSET_DIR_MAP_PRI_URI_TYP_UK
  ON tx_question_set_dir_map
  USING btree
  (question_set2tx_question_set ,uri_type,
  (CASE WHEN uri_type = 201900 THEN null::varchar(100)
     ELSE question_set_dir_map_key END);

Worked for me.  Try it if you are still interested.
Just do proper casting of null (it was varchar(100) in my case).


​This is a multi-column index - with the third column being an expression - as opposed to a single-column index of a composite.

David J.
​
 ________________________________________________________________________________

You are right.
But the question is whether OP needs a single_column_index_of_a_composite or multi_column_index will do.

Regards,
Igor Neyman


view thread (11+ messages)  latest in thread

Message-ID: <A76B25F2823E954C9E45E32FA49D70ECCD68075F@mail.corp.perceptron.com>
Permalink:  ../A76B25F2823E954C9E45E32FA49D70ECCD68075F@mail.corp.perceptron.com/
Also on:    postgresql.org/message-id/A76B25F2823E954C9E45E32FA49D70ECCD68075F@mail.corp.perceptron.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-sql@postgresql.org
  Cc: ineyman@perceptron.com, david.g.johnston@gmail.com, michaeljmoore@gmail.com
  Subject: Re: simple function index question
  In-Reply-To: <A76B25F2823E954C9E45E32FA49D70ECCD68075F@mail.corp.perceptron.com>
  References: <CACpWLjPDmEqqu4DcuOPH_EfmrZPshW-aN9Wq+GBXOZf-ZvHrHA@mail.gmail.com> <CAFnxYwjm3BjTy6pLxL3DNSrovxbqAU5wVPzyp-JjfOc7Bv2DTw@mail.gmail.com> <CACpWLjPNQEUTc49OuWKA5U0qs7-cVmP1J_u_GECv-BS5Eciteg@mail.gmail.com> <A76B25F2823E954C9E45E32FA49D70ECCD68070C@mail.corp.perceptron.com> <CAKFQuwbeqMpTanF3h+Mbddot9-100Vj3KbkivAD47M4-VWEwfA@mail.gmail.com> <A76B25F2823E954C9E45E32FA49D70ECCD68075F@mail.corp.perceptron.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