On 2015-09-30 11:46 AM, Deepak Hegde wrote:
> Hi All,
>
> I have a to copy entry from on database to another which have the
> similar structure.
>
> So I am using the method of ATTACH the DB and INSERT statement to insert
> the 200 entries at a time.
> I have observed that as the entries in the copied database increases
> event though I am inserting 200 entry only, time for insertion keeps on
> increasing.//...

Hi Deepak - (Not related to Mr. Chopra I trust?)

The time taken to insert rows into a database is a function of the 
database size with several factors adding to it.

Firstly, you need to use transactions to make the inserts faster if you 
are going to do multiple inserts. Secondly, it will be much faster if 
you insert using a SELECT query (as you do), but it can be the actual 
SELECT that takes longer to execute since I assume the original/source 
DB would have grown too. See taht you have good index for fast querying 
on the source DB.

The time taken to insert items into a database (with already many items 
in it) is mostly due to needing to expand the indices of the target DB. 
If you have no Index at all (though you will still likely have the 
hidden rowid index) then theoretically the database can grow without 
using much time. For every Index you add, the time taken to insert will 
go up because the DB has to add and re-organize the B-Tree used for 
every index (In the standard case).

Some bit of time gets lost on the file-handling of large files once they 
grow significantly, but that is usually rather negligible compared to 
the Indexing factors.

HTH,
Ryan


Reply via email to