[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Repeated SQL queries when doing 'svn st'

From: Justin Erenkrantz <justin_at_erenkrantz.com>
Date: Sat, 4 Sep 2010 11:20:12 -0700

On Sat, Sep 4, 2010 at 10:18 AM, Justin Erenkrantz
<justin_at_erenkrantz.com> wrote:
> When compiled with SVN_DEBUG and SQLITE3_DEBUG and 'svn st' against a
> svn trunk WC, a number of things pop out.
>
> We perform 28,062 SQL queries.
>
> ---
> DBG: sqlite.c:  63: sql="select root, uuid from repository where id = 1;"
> ---
>
> We execute *this* query (STMT_SELECT_REPOSITORY_BY_ID) 2215 times.  Yikes.
>
> I think this has to do with svn_wc__db_base_get_info's call to
> fetch_repos_info.  I'd think we'd be able to cache this result.  I'll
> take a stab and see if this reduction saves us any real time.  The
> root and uuid should be constant for an wc_id...right?

It's actually svn_wc__db_read_info's fetch_repos_info call...

With 2215 queries: ~/Applications/svn-trunk-no-debug/bin/svn st 0.26s
user 0.05s system 98% cpu 0.311 total
With a quick-and-hacky cache:
~/Applications/svn-trunk-no-debug/bin/svn st 0.25s user 0.05s system
98% cpu 0.298 total

It's worth a good 4% time savings...

A quick back-of-the-envelope calculation says that if we can remove
all of the extraneous 13,290 SQL queries (out of 28,062 ; leaving
behind 14,772 queries) - we will likely gain something like 25% from
the 0.311 down to around 0.233 seconds.

It's still much higher than 0.050 than 'svn st' on 1.6.x yields, but
inching closer... -- justin
Received on 2010-09-04 20:20:51 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.