db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak" <tom...@gmail.com>
Subject Re: How to speed up its' work on Oracle.
Date Thu, 27 Apr 2006 19:39:11 GMT
On 4/27/06, Jun Li <allanjunli@gmail.com> wrote:

> The xml was generated by DdlUtils, so the layout order was guaranteed as:
> <A....>
> ....
> <A...>
> <B...>
> .....
> <B ...>
> <C....>
> The interesting thing is about the foreign key relationship, let's say A has
> a foreign key to B, and B has a foreign to C.
> Now if I want to insert record A1 which has a foreign key to record B1, B1
> should be insert first, no problem. However B1 has a foreign key to C1, so
> the insert order is:
> C1, B1, A1.
> Back to A2, it has a foreign key to B2 not B1 which has been inserted, and
> B2 has a foreign key to C2. So: C2, B2, A2.
> Batch mode is useless in this case.
> However, what if you do this: insert C1....n, then B1....n, follow by
> A1...n. Batch mode can help then.
> So, what I am saying is if the record you are inserting has a foreign key
> relation to another table, just insert all the records in that table not
> just the one required by the current insertion, because it's most likely the
> records in the foreign key table will be needed later. And this will prevent
> the insert operation jumping between tables which will turn batch mode off.
> Therefore, the actually insertion order is not exactly the same as the
> layout in xml, it should follow the table relation hierarchy.

Well, this is not as easy as it sounds. Basically you have to find the
traversal path through the graph of the model (you can have circular
relationships between tables) which minimizes the number of forward
references (e.g. rows for tables that reference other rows that have
not been read yet).
This is a bit more complex and not that urgent (data insertion works,
though its not as fast as it could be), so its not on the agenda for
1.0. But please feel free to add an issue in JIRA.
Depending on whether the schema XML was generated manually, you should
be able to get the effect that you wanted by changing the table order


View raw message