Re: Needless additional partition check in INSERT?

Поиск
Список
Период
Сортировка
От Amit Khandekar
Тема Re: Needless additional partition check in INSERT?
Дата
Msg-id CAJ3gD9ctkb5nJsT3ToZ4azJOdvem0V3_UtpxRkNk8r5aj5dDBw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Needless additional partition check in INSERT?  (David Rowley <david.rowley@2ndquadrant.com>)
Ответы Re: Needless additional partition check in INSERT?  (Amit Khandekar <amitdkhan.pg@gmail.com>)
Список pgsql-hackers
On 10 May 2018 at 15:26, David Rowley <david.rowley@2ndquadrant.com> wrote:
> Yeah, the comments do need work. In order to make it a bit easier to
> document I changed the way that check_partition_constr is set. This is
> now done with an if/else if/else clause for both COPY and INSERT.
>
> Hopefully, that's easier to understand and prevents further mistakes.
>
> Patch attached.

The patch looks good in terms of handling the redundant constraint check.

Since this patch also does some minor code restructuring with the if
conditions, below are some comments on them :

With the patch, the if condition uses ri_PartitionCheck, and further
ExecConstraints() also uses ri_PartitionCheck to decide whether to
call ExecPartitionCheck(). So instead, if we just don't bother about
ri_PartitionCheck outside ExecConstraints() and let ExecConstraints()
handle it, then the if conditions would get simpler :

if (resultRelInfo->ri_PartitionRoot == NULL ||
    (resultRelInfo->ri_TrigDesc &&
     resultRelInfo->ri_TrigDesc->trig_insert_before_row))
   check_partition_constr = true;
else
   check_partition_constr = false;

-- 
Thanks,
-Amit Khandekar
EnterpriseDB Corporation
The Postgres Database Company


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

Предыдущее
От: CK Tan
Дата:
Сообщение: Re: Having query cache in core
Следующее
От: Amit Khandekar
Дата:
Сообщение: Re: Needless additional partition check in INSERT?