Re: partitioning using dblink - Mailing list pgsql-general

From Marko Kreen
Subject Re: partitioning using dblink
Date
Msg-id e51f66da0802290907m5c3ff38bk1724ba564efce3a2@mail.gmail.com
Whole thread Raw
In response to Re: partitioning using dblink  (Scara Maccai <m_lists@yahoo.it>)
List pgsql-general
On 2/29/08, Scara Maccai <m_lists@yahoo.it> wrote:
> I'm sorry, I didn't understand you post...
>
>  1) Why does my current implementation is not working? Hierarchy doesn't work with views in general, not only with
dblink

Exactly, because inheritance/constraint exclusion wont work with views.

>  2) Why am I supposed to use unions in the view?

So that query evaluator can exclude unnecessary partitions.

Given view:

  create view.. as
    select * from blah() where id >= 0 and id < 10000
    union all
    select * from blah() where id >= 10000 and id < 20000
    ...

Then running query

  select * from view where id = 10;

can skip partitions by simply examining where expression.

Quite likely you need to tune it for your case.

>  3) I know that I am doing select * from tbl in the remote db; that is something I can work on later.
>  At least I would like to see it working, since there is nothing in the docs that says it shouldn't be working...
>  4) I am not able to rewrite my queries.

Have fun then.

--
marko

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: errors in pg_restore on windows?
Next
From: Scara Maccai
Date:
Subject: Re: partitioning using dblink