On Feb 3, 2011, at 6:53 PM, Kevin Wojniak wrote:

> The trigger is ran once via sqlite3_exec();

Hmm... you mean the trigger is run every single time you perform an insert, no?

> Any insight as to why the trigger is significantly slower?

It adds significant overhead for each and every insert.

> I hope I'm missing something basic.

Yes! Don't use triggers :)

Do you really need to store that value? As oppose to have it computed? After 
all, you should always be able to query for it, no?

Alternatively, update it in bulk, e.g: update root set num_children = ( select 
count( * ) from root as parent where parent.parent_rowid = root.rowid ) where 
rowid in ( select distinct parent_rowid from root ) or something
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to