[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: Branko Čibej <brane_at_e-reka.si>
Date: Wed, 16 Feb 2011 20:05:56 +0100

On 16.02.2011 19:25, Julian Foad wrote:
> 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.

Good catch. We'll need an escape clause, too.

>> + 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.)

My not very humble opinion -- we can play silly buggers trying to
optimize this bit of the query, but effort would be better spent in
merging NODES and ACTUAL_NODE, which in turn would allow us to drop the
second query altogether and halve the total time needed to populate the
cache table.

-- Brane
Received on 2011-02-16 20:07:58 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.