"Daniel Franke" <[EMAIL PROTECTED]> wrote:
>> 
> Another question that arose today:
> Is there any penalty for switching tables during INSERTs within the
> same COMMIT? E.g.
> 
>     BEGIN;
>     INSERT INTO tableA VALUES ...;
>     INSERT INTO tableB VALUES ...;
>     INSERT INTO tableA VALUES ...;
>     INSERT INTO tableB VALUES ...;
>      :
>     COMMIT;
> 
> opposed to
> 
>     BEGIN;
>     INSERT INTO tableA VALUES ...;
>     INSERT INTO tableA VALUES ...;
>     INSERT INTO tableA VALUES ...;
>       :
>     COMMIT;
>     BEGIN;
>     INSERT INTO tableB VALUES ...;
>     INSERT INTO tableB VALUES ...;
>     INSERT INTO tableB VALUES ...;
>       :
>     COMMIT;
> 
> Yesterday I did the former, it seemed to take ages. Today I use the
> latter ... it seems to be faster?!
> 

My guess is that locality of reference would make the second
approach faster than the first.  I would also guess that the
resulting database would run queries faster as well.
--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to