Re: WIP: Rework access method interface

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: WIP: Rework access method interface
Date: 2015-08-25 15:27:31
Message-ID: 55DC8963.9040306@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-08-25 15:36:01 Re: WIP: Rework access method interface
Previous Message Tom Lane 2015-08-25 15:21:57 Re: psql - better support pipe line