Lists: | pgsql-hackers |
---|
From: | "naman(dot)iitb" <naman(dot)bbps(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Creating partial index on a relation |
Date: | 2013-10-29 08:15:21 |
Message-ID: | 1383034521384-5776230.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hello
I am doing a small project in Postgress where i have to achieve the
following:
Suppose i know the index name(lets say index1) and the relation(table1) on
which partial index to has to be build.
I was looking through the code and found that IndexStmt-->whereClause is the
one that i need to populate manually .
As of know i am successful in creating index by giving a call to Method
DefineIndex of indexcmds.c that creates a index on the relation, but this
index is not an partial index.
I found that DefineIndex takes *Expr *predicate* as an parameter which
specifies that partial index has to be built. This predicate is nothing but
*IndexStmt-->whereClause *
So is there a way to populate manually IndexStmt-->whereClause
An example of partial index that i need is if my My table1 schema is (a int
,b int ,c int)
index on c where a is null, b is null and c is not null
Thanks in advance
Regards
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Creating-partial-index-on-a-relation-tp5776230.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.
From: | Kevin Grittner <kgrittn(at)ymail(dot)com> |
---|---|
To: | "naman(dot)iitb" <naman(dot)bbps(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Creating partial index on a relation |
Date: | 2013-10-31 12:42:01 |
Message-ID: | 1383223321.55824.YahooMailNeo@web162902.mail.bf1.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
naman.iitb <naman(dot)bbps(at)gmail(dot)com> wrote:
> An example of partial index that i need is if my My table1 schema
> is (a int ,b int ,c int)
>
> index on c where a is null, b is null and c is not null
Your question is not very clear, but perhaps you are looking for
something like this:
CREATE INDEX index1 ON table1 (c)
WHERE a IS NULL AND b IS NULL AND c IS NOT NULL;
This list is for discussion of adding features and fixing bugs in
the the PostgreSQL product. For future posts requesting help with
*using* PostgreSQL please use the pgsql-general list.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
---|---|
To: | "naman(dot)iitb" <naman(dot)bbps(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Creating partial index on a relation |
Date: | 2013-10-31 12:48:58 |
Message-ID: | 527251BA.9090807@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 10/29/2013 04:15 PM, naman.iitb wrote:
> So is there a way to populate manually IndexStmt-->whereClause
Unless you have an _extremely_ compelling reason, you should probably
just use the SPI routines to execute a CREATE INDEX command.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services