pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Partitioning Tables
Date: Fri, 5 Feb 2021 12:59:24 -0600
Message-ID: <48402931-ad7a-7cf8-b30a-4d1a86408927@gmail.com> (raw)
In-Reply-To: <B77077E0-3B97-4408-9BFA-D4F5137C2689@elevated-dev.com>
References: <248F0103-EA30-4536-963B-73BD7477AF08@illinois.edu>
	<B77077E0-3B97-4408-9BFA-D4F5137C2689@elevated-dev.com>

On 2/5/21 12:42 PM, Scott Ribe wrote:
>> On Feb 5, 2021, at 11:27 AM, Campbell, Lance <lance@illinois.edu> wrote:
>>
>> So if I do a query like the below it would ideally pull from partition group_member_a rather than group_member_other.  However, how would PostgreSQL know on insert a group_member into the proper partition?
>>   
>> Select group_member.* from group, group_member WHERE group.type=’A’ and group.id=group_member.user=’bob smith’;
> When you define the partition, you declare what values go into it. With PG 12, you can insert into the parent and the row will get redirected into the right place. Some older versions (I don't remember how old) required you to insert into the right table, or some voodoo with rewrite rules or triggers.
>
> In other words, smarts about which partitions to scan in your example pre-dates smarts about inserting.
>
> I don't remember for sure, but I think maybe PG 13 adds the feature where if you update the group type, the row gets moved. Prior, you'd have to delete and re-insert. Someone correct me?

I don't know about v13, but v12 (and below) error on updating the partition 
key.  (That's a common limitation which helps the optimizer /know/ what's in 
a partition.)

-- 
Angular momentum makes the world go 'round.





view thread (14+ messages)  latest in thread

Message-ID: <48402931-ad7a-7cf8-b30a-4d1a86408927@gmail.com>
Permalink:  ../48402931-ad7a-7cf8-b30a-4d1a86408927@gmail.com/
Also on:    postgresql.org/message-id/48402931-ad7a-7cf8-b30a-4d1a86408927@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Partitioning Tables
  In-Reply-To: <48402931-ad7a-7cf8-b30a-4d1a86408927@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox