The code I use can calculate data flow for sql queries (summing xRead iAmt
in VFS) and I noticed that many variations of INSERT SELECT led to very big
data flow (multiplication of the db size). I thought that such queries can
be optimized if both tables are indexed accordingly and finally the
following query

INSERT OR IGNORE INTO Table (Field) SELECT SomeOtherField FROM OtherTable
ORDER BY SomeOtherField

produced significant reduce in data flow. (Field Is indexed in Table). I
don't think the difference is related to some caching since the variant
without ORDER BY shows 50 MB data transfer for 17 MB base while adding ORDER
BY reduces it to 1 MB (1:50 ratio so far).

But my other query uses more complex schema (with LEFT JOIN and several
fields (although indexed together)). The problem is I could not optimize the
query to reduce the data flow in this case.
Are there any specific requirements for the inserts like the first one?
Couldn not to find information about this in the documentation.

Thanks

Max
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to