On Fri, Feb 4, 2011 at 7:26 AM, Simon Slavin <slav...@bigfraud.org> wrote:

>
> On 4 Feb 2011, at 9:42am, Dan Kennedy wrote:
>
> > The problem is that the trigger version is creating a statement journal
> > for each INSERT statement. It doesn't *really* need to, as there is no
> > way that this statement/trigger can hit a constraint after modifying
> > any rows. However at the moment I think SQLite opens a statement
> > transaction for any statement that will fire one or more triggers.
>
> I'm not quite up with the terminology but now I'm interested.
>
> First, do you feel that this behaviour is a bug and can be addressed in
> future versions ?
>


I strive to be more precise and reserve the word "bug" for cases where the
software gets the wrong answer.  When the correct answer is obtained, just
more slowly than one hopes, that is not a "bug" but a "performance
enhancement opportunity."

We will look into taking advantage of this performance enhancement
opportunity to make SQLite run faster in a future release.  But we have to
proceed carefully here.  Performance enhancements are our #1 source of
bugs, since performance enhancements typically result in more complex code,
and complication tends to lead to bugs.  Our first priority is to avoid
bugs.  It is seldom helpful to get the wrong answer quickly.


> Second, is this the same as the automatic creation of transactions if the
> programmer doesn't create a transaction ?  In other words, if the programmer
> doesn't do a BEGIN, does SQLite make one transaction for the INSERT, and
> another for each action inside anything that triggers ?  Or do all the
> actions triggered by the INSERT get included within the same automatic
> transaction ?
>

When a statement is one of several statements that occur in the middle of a
larger BEGIN...END and that statement might fail, we have to open a separate
journal that can be used to rollback partial results of that one statement
without having to rollback the entire transaction.  The statement journal is
used for that purpose.


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



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to