Re: WIP: Rework access method interface - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: WIP: Rework access method interface
Date
Msg-id 55DC8963.9040306@BlueTreble.com
Whole thread Raw
In response to Re: WIP: Rework access method interface  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Responses Re: WIP: Rework access method interface  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On 8/24/15 9:49 AM, Alexander Korotkov wrote:
> 2) Non-index access methods reuse pg_class.relam but don't reuse pg_am.
> This violates relational theory because single column reference multiple
> tables.
> 3) Non-index access methods reuse both pg_class.relam and pg_am. This
> violates relational theory because we store different objects in the
> same table.
>
> I'd say we already have precedent of #2. It's pg_depend which reference
> objects of arbitrary types.
> In the #3 we really shouldn't keep any specific to index am in pg_am.

In userspace, table inheritance handles this nicely. Stick a "type" 
field in the parent so you know what kind of entity each record is, 
along with all your common fields. Everything else is in the children, 
and code generally already knows which child table to hit or doesn't 
care about specifics and hits only the parent. Perhaps something similar 
could be made to work with a catalog table.

#2 seems like a twist on the same idea, except that there's fields in 
pg_class that tell you what the child is instead of a real parent table. 
Presumably we could still create a parent table even if the internals 
were going through pg_class.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: psql - better support pipe line
Next
From: Alvaro Herrera
Date:
Subject: Re: WIP: Rework access method interface