Hyrum K Wright wrote on Wed, Apr 06, 2011 at 11:44:47 -0500:
> On Wed, Apr 6, 2011 at 7:58 AM, Greg Stein <gstein_at_gmail.com> wrote:
> >...
> >>...
> >> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Apr 5 21:53:47 2011
> >>...
> >> svn_error_t *
> >> +svn_wc__db_changelist_list_notify(svn_wc_notify_func2_t notify_func,
> >> + void *notify_baton,
> >> + svn_wc__db_t *db,
> >> + const char *local_abspath,
> >> + apr_pool_t *scratch_pool)
> >> +{
> >
> > Should the contents of this function be transacted?
>
> Not needed: the contents of the temporary table are only visible to
> the database connection that created them (and the table itself will
> automatically disappear when the connection is closed). As a result,
> no other connection or thread could interact with this table while
> this function is running.
>
Using a transaction is twice as fast for me in the following testcsae:
[[[
% cat foo.sh
#!/bin/zsh
x=`for i in $(seq 100000); do echo "insert into foo(i) values($i);"; done`
y="create temporary table foo (i integer); create index ii on foo(i);"
time sqlite3 :memory: <<< "$y; $x;"
time sqlite3 :memory: <<< "$y; BEGIN; $x; COMMIT;"
% zsh -e foo.sh
sqlite3 :memory: <<< "$y; $x;" 1.42s user 1.23s system 97% cpu 2.707 total
sqlite3 :memory: <<< "$y; BEGIN; $x; COMMIT;" 0.74s user 0.01s system 99% cpu 0.745 total
]]]
(the <<< operator is a one-line heredoc, 'redirect this string to the
process's stdin)
> -Hyrum
Received on 2011-04-07 03:37:47 CEST