From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Robert Haas <robertmhaas(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Custom table AMs need to include heapam.h because of BulkInsertState |
Date: | 2019-07-16 18:46:11 |
Message-ID: | 20190716184611.6jy7g4t4kongaeg7@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Sorry for not chiming in again earlier, I was a bit exhausted...
On 2019-07-03 19:46:06 +1200, David Rowley wrote:
> I think the only objection to doing it the way [2] did was, if there
> are more than MAX_PARTITION_BUFFERS partitions then we may end up
> evicting the CopyMultiInsertBuffer out of the CopyMultiInsertInfo and
> thus cause a call to table_finish_bulk_insert() before we're done with
> the copy.
Right.
> It's not impossible that this could happen many times for a
> given partition. I agree that a working version of [2] is cleaner
> than [1] but it's just the thought of those needless calls.
I think it's fairly important to optimize this. E.g. emitting
unnecessary fsyncs as it'd happen for heap is a pretty huge constant to
add to bulk loading.
> For [1], I wasn't very happy with the way it turned out which is why I
> ended up suggesting a few other ideas. I just don't really like either
> of them any better than [1], so I didn't chase those up, and that's
> why I ended up going for [2].
Yea, I don't like [1] either - they all seems too tied to copy.c's
usage. Ideas:
1) Have ExecFindPartition() return via a bool* whether the partition is
being accessed for the first time. In copy.c push the partition onto
a list of to-be-bulk-finished tables.
2) Add a execPartition.c function that returns all the used tables from
a PartitionTupleRouting*.
both seem cleaner to me than your proposals in [1], albeit not perfect
either. I think knowing which partitions are referenced is a reasonable
thing to want from the partition machinery. But using bulk-insert etc
seems outside of execPartition.c's remit, so doing that in copy.c seems
to make sense.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2019-07-16 18:48:20 | Re: A little report on informal commit tag usage |
Previous Message | Alexander Korotkov | 2019-07-16 18:44:39 | Re: SQL/JSON path issues/questions |