Re: Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1
Дата
Msg-id 603c8f070811270647g1f069ed5ucefbb755dac7aa58@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1  ("Jaime Casanova" <jcasanov@systemguards.com.ec>)
Список pgsql-hackers
>> I like the idea of using table inheritance as a foundation for this
>> feature, but I think it's not going to be very useful for real-world
>> applications without cross-table indexes.  Suppose for example that I
>> have five years worth of data (thus, 60 partitions) and each
>> transaction has a unique identifier of some sort that is unrelated to
>> the date.  It's bad enough that a query like this has to check every
>> partition:
> you haven't. the WHERE clause in your hipotetical CREATE PARTITION
> should create a check constraint on the child (inherited) table and if
> you have constraint_exclusion to on you will check just the
> partition(s) that match with the check constraint.

The problem is that constraint exclusion will not be able to exclude
anything for queries unrelated to the partition key. If my
transactions are identified by UUIDs or similar, there's no way to
predict which table will contain any particular value.  You end up
having to scan them all, and even if they all have individual indices
on the column in question, that's still 60 index scans instead of 1.

>> What's even worse (at least IMHO) is that there's no way to use
>> transaction (uuid) as a reference for a foreign key.
> not directly, but you always can create a trigger instead of the
> foreign key constraint...
> mmm...the docs says that there is no good workaround, what about
> mention a trigger?

I think it's pretty hard to make this bulletproof.  I think the
triggers that enforce ordinary foreign key constraints contain some
magical cross-checks on transaction commit that can't easily be
emulated by user-written triggers.  In any case, it's a long way from
"Oh, yeah, that just works."

...Robert


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Robert Haas"
Дата:
Сообщение: Re: Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1
Следующее
От: "Jaime Casanova"
Дата:
Сообщение: Re: Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1