Обсуждение: Are partial indicies supported?

Поиск
Список
Период
Сортировка

Are partial indicies supported?

От
Martijn van Oosterhout
Дата:
Hi,

In the documentation there is this page about partial indicies:

http://postgresql.planetmirror.com/devel-corner/docs/user/partial-index.htm

 From my reading of that I would guess they are supported but since they
aren't mentioned anywhere else, I guess they're not.

Can somone clarify the situation please?

--
Martijn van Oosterhout <kleptog@cupid.suninternet.com>
http://cupid.suninternet.com/~kleptog/

Re: Are partial indicies supported?

От
Tom Lane
Дата:
Martijn van Oosterhout <kleptog@svana.org> writes:
> In the documentation there is this page about partial indicies:
> http://postgresql.planetmirror.com/devel-corner/docs/user/partial-index.htm
>  From my reading of that I would guess they are supported but since they
> aren't mentioned anywhere else, I guess they're not.
> Can somone clarify the situation please?

There is no provision in the CREATE INDEX grammar for a partial index
condition clause.  Some digging in the CVS archives shows that this
was true clear back to Postgres95, and that Postgres 4.2 was the last
release that accepted a condition clause.  I have no idea why Andrew and
Jolly removed it --- they certainly didn't hesitate to support Postgres
4.2's other non-ANSI-SQL extensions to CREATE INDEX.

There is still a substantial amount of code in the planner and executor
to support partial indexes, however.  Since it hasn't been exercised in
six or seven years, it's doubtless suffering bit rot ... but it's there.

An optimistic view is that a couple more lines of code in gram.y and
some vigorous dust-sweeping would resurrect the feature.  A pessimistic
view is that Andrew and Jolly disabled the feature because they knew
that it was fatally broken for some undocumented, now-forgotten reason.
The truth is probably somewhere in between.

I'd like to see the feature brought back, myself, but I dunno when it
will get to the top of someone's to-do queue.

            regards, tom lane

Re: Are partial indicies supported?

От
Martijn van Oosterhout
Дата:
Tom Lane wrote:

[snip]

That's a very good explanation, thanks. Is it possible to get that
explanation into the docs at that page I mentioned above?

> I'd like to see the feature brought back, myself, but I dunno when it
> will get to the top of someone's to-do queue.

I'd like that too, but the query planner sounds like one of the trickier
parts of postgres, dunno if I want to look :)

--
Martijn van Oosterhout <kleptog@cupid.suninternet.com>
http://cupid.suninternet.com/~kleptog/