Subject | Newbie transaction questions |
---|---|
Author | Joe Martinez |
Post date | 2002-12-09T18:52:28Z |
I have a process where I'm inserting one master record, and several
(approx. 1-50) detail records. I converted my app over from the BDE to
IBO, and for some reason, this particular process got slower when I
switched, as I'm hearing complaints from my customers about it.
Anyway, I'm currently just using two TIBOTable objects for the two tables,
and doing the Insert(), FieldByName(), Post() thing (once for the master
record and multiple times for the detail records). I'm looking to speed it
up, so I am planning on generating the SQL myself for the inserts, using
TIB_DSQL objects to execute them.
Some questions:
1) Seeing that there are generally less than 50 detail records, would there
be any appreciable speed difference using a prepared parameterized query,
rather than just re-generating the SQL each time?
2) For this whole procedure, would there be any benefit to explicit
transaction control, or would I be fine to just use the default transaction?
3) If I use the default transaction, when will each insert be committed?
4) If I use explicit transaction control, should the whole thing be one
transaction, or should it be split up? One transaction for the master, and
one for all the detail records? A new transaction for each insert? I'm
thinking that the shorter the transactions the better, to minimize key
conflicts with other clients, but I'm not sure about the performance
implications.
Thanks,
Joe
(approx. 1-50) detail records. I converted my app over from the BDE to
IBO, and for some reason, this particular process got slower when I
switched, as I'm hearing complaints from my customers about it.
Anyway, I'm currently just using two TIBOTable objects for the two tables,
and doing the Insert(), FieldByName(), Post() thing (once for the master
record and multiple times for the detail records). I'm looking to speed it
up, so I am planning on generating the SQL myself for the inserts, using
TIB_DSQL objects to execute them.
Some questions:
1) Seeing that there are generally less than 50 detail records, would there
be any appreciable speed difference using a prepared parameterized query,
rather than just re-generating the SQL each time?
2) For this whole procedure, would there be any benefit to explicit
transaction control, or would I be fine to just use the default transaction?
3) If I use the default transaction, when will each insert be committed?
4) If I use explicit transaction control, should the whole thing be one
transaction, or should it be split up? One transaction for the master, and
one for all the detail records? A new transaction for each insert? I'm
thinking that the shorter the transactions the better, to minimize key
conflicts with other clients, but I'm not sure about the performance
implications.
Thanks,
Joe