Re: Partitionin with check functions

From: fatih ozturk <ozturkfa(at)yahoo(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Partitionin with check functions
Date: 2009-03-31 11:07:08
Message-ID: 397285.75133.qm@web111503.mail.gq1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thank you

"Yes, it does.  It might be worthwile to use

  WHERE sel=123 AND mod(sel,6)=3

I think you could use a rule to add the mod() condition automatically.
"
this is great idea

But the problem is i did not accomplish to find a way to change query like

     partitioning=# select * from mainlog where sel=22;

to
   
     partitioning=# select * from mainlog where sel=22 and mod(sel,6)=4;

"on select" rules just creates views, dont routes the queries.
I cant use tirggers for selects.
Is there exists a way of changing select query before query plan generated?

Any ideas?

I am very appreciative for your answers and interest.

Thanks

--- On Mon, 3/30/09, Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com> wrote:

From: Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com>
Subject: Re: [ADMIN] Partitionin with check functions
To: pgsql-admin(at)postgresql(dot)org
Date: Monday, March 30, 2009, 4:08 PM

In article <2499(dot)1238420859(at)sss(dot)pgh(dot)pa(dot)us>,
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> In particular, a constraint like "sel=123" is *not* going to lead the
> planner to draw any conclusions about the value of "mod(sel,6)".
> Now, if you'd written "WHERE mod(sel,6)=3", I think it would draw
> the right conclusions.

Yes, it does.  It might be worthwile to use

  WHERE sel=123 AND mod(sel,6)=3

I think you could use a rule to add the mod() condition automatically.

Browse pgsql-admin by date

  From Date Subject
Next Message Agustin Ignacio Genoves 2009-03-31 11:31:43 Re: Data type to store files
Previous Message Marc Abbott 2009-03-31 08:21:28 PG Patch