Re: Directing Partitioned Table Searches

From: Vick Khera <vivek(at)khera(dot)org>
To: Bill Thoen <bthoen(at)gisnet(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Directing Partitioned Table Searches
Date: 2011-02-07 19:33:20
Message-ID: AANLkTikG3eZVYq8m7MVhYhwPJmGDMWRj8dWuYCZynWej@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 7, 2011 at 1:17 PM, Bill Thoen <bthoen(at)gisnet(dot)com> wrote:
> Thanks. That sounds simple enough. Since I want to automate this, I guess
> the next step is to learn how to create and  execute a "dynamic" query.  I
> think I know how to do that.
>

In perl, it looks something like this:

$part = compute_partition($value);
$sth = $dbh->prepare("select * from table_$part where foo=?");
$sth->execute($value);

you just interpolate the parts you need in the query string.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vincent Veyron 2011-02-07 20:30:23 Re: Very slow moving between partition
Previous Message Edoardo Panfili 2011-02-07 19:27:57 Re: postgis 1.5.2 installation configure: WARNING: could not locate CUnit required for liblwgeom unit tests