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

Re: SQLite and callbacks

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Wed, 16 Feb 2011 18:25:35 +0000

On Tue, 2011-02-15, Stefan Sperling wrote:
> [[[
> Improve performance of svn proplist in a similar way as was done in r1039808.
> But, this time, avoid problems with callbacks invoked during sqlite
> transactions by storing results in a temporary table and invoking
> callbacks during a query on the temporary table.
[...]
> ]]]

> Index: subversion/libsvn_wc/wc.h
> ===================================================================
> +-- STMT_CACHE_NODE_PROPS_RECURSIVE
> +CREATE TEMPORARY TABLE temp__node_props_cache AS
> + SELECT local_relpath, kind, properties FROM nodes_current
> + WHERE wc_id = ?1
> + AND (?2 = '' OR local_relpath = ?2 OR local_relpath LIKE ?2 || '/%')

For correct use of 'LIKE' with arbitrary file names, we need to escape
the pattern (and declare that here), which in turn means the unescaped
pattern and the escaped pattern need to be passed in as two separate
params, I think. Same again in a similar query below.

> + AND local_relpath NOT IN (
> + SELECT local_relpath FROM actual_node WHERE wc_id = ?1)

I wonder if this subexpression would be faster rewritten as something
like

       AND NOT (SELECT 1 FROM actual_node
                WHERE wc_id = ?1 AND local_relpath = ?2)

(I'm not sure whether "NOT (SELECT 1 ...)" is the correct or best way to
say "this selection is empty", but you get the idea.)

> + AND (presence = 'normal' OR presence = 'incomplete');
> +CREATE UNIQUE INDEX temp__node_props_cache_unique
> + ON temp__node_props_cache (local_relpath);

- Julian
Received on 2011-02-16 19:26:19 CET

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.