From: | Vick Khera <vivek(at)khera(dot)org> |
---|---|
To: | Seref Arikan <serefarikan(at)kurumsalteknoloji(dot)com> |
Cc: | Bill Moran <wmoran(at)potentialtech(dot)com>, Tim Uckun <timuckun(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: What's a reasonable maximum number for table partitions? |
Date: | 2015-02-13 16:54:28 |
Message-ID: | CALd+dcffktmS3x7bCgtbJvfdrkP46AtKwqxsZJ+tUJ3NVVpYJg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Feb 13, 2015 at 11:29 AM, Seref Arikan <
serefarikan(at)kurumsalteknoloji(dot)com> wrote:
> Hi Bill,
> Could you point at some resource(s) that discuss inserting directly into
> the partition? Would it be possible to read directly from the partition as
> well?
>
> When preparing your SQL statement, you just specify the partition directly
like this. Here's a snippet from my code in perl.
my $msg_recipients_modulo = 100; # number of partitions
sub msg_recipients_part($) {
use integer;
my $id = shift;
my $part = $id % $msg_recipients_modulo;
return 'msg_recipients_' . sprintf('%02d',$part);
}
then in when generating sql you do
$table = msg_recipients_part($msg_id);
$sql = "SELECT FROM $table WHERE ..."
or something similar for insert/update.
From | Date | Subject | |
---|---|---|---|
Next Message | Seref Arikan | 2015-02-13 16:56:27 | Re: What's a reasonable maximum number for table partitions? |
Previous Message | Seref Arikan | 2015-02-13 16:36:55 | Re: What's a reasonable maximum number for table partitions? |