On 17.11.2013 14:33, Bert Huijben wrote:
>> -----Original Message-----
>> From: Branko Čibej [mailto:brane_at_wandisco.com]
>> Sent: zondag 17 november 2013 14:08
>> To: dev_at_subversion.apache.org
>> Subject: Re: Using Sqlite in libsvn_wc towards Subversion 1.9++
>> On 17.11.2013 13:34, Bert Huijben wrote:
>>> For Subversion 1.8 I spend a lot of time optimizing our use of Sqlite in the
>>> working copy to work as optimal as possible with the then Supported range
>>> Sqlite versions (3.7.12-3.7.19). Then a few months later in Sqlite 3.8.0 a
>>> new query planner was introduced that broke quite a few of the
>>> I/we assumed were ok, because we did things different than the Sqlite
>>> developers intended.
>>> For Subversion 1.8 we did:
>>> * Try to support as many sqlite versions as possible (3.7.12-infinity)
>>> * Try to optimize queries without describing our layout
>>> * Add many columns to indexes to make them unique and avoid going back
>>> the original table when possible.
>>> This goes against +- all the recommendations of the Sqlite designers as they
>>> * Provide your users exactly the sqlite version you tested against -> link
>>> statically as part of your source
>>> * Provide statistics about your table.
>>> * Use 'good indexes' (either with stats; or with a good first key)
>>> As users that have upgraded to Sqlite 3.8.0 or later have found out our
>>> design choices really affect performance on huge working copies: several
>>> performance critical queries during operations such as commit, delete and
>>> revert are now handled as a full table scan.
>>> To optimize our queries for Subversion 1.7 and 1.8 we should probably
>>> a bit of code to fill the sqlite statistics table with the information
>>> Sqlite needs to make the right decisions,
>> I've looked at pre-filling the sqlite_stats1 table. I think it's not
>> going to work because apparently some of the stats columns contain index
>> row counts, which of course vary not only from one working copy to the
>> next, but also during the lifetime of a working copy. Maybe there's a
>> way to fake "infinite" size indexes; I haven't found documentation on
>> how to do that. Most of the analyze results seem to be concerned with
>> the wc_id column.
>> As a data point: running ANALYZE in a wc.db for a checkout of
>> ^/subversion takes about half a minute on my mac (with SSD, fwiw), so I
>> don't think re-running it incrementally is an option.
>>> but for Subversion 1.9 and later
>>> we should decide what we want to do to make sure our users will never
>>> such a regression any more.
>>> I think we should at least:
>>> * Update our indexes to be closer to what the Sqlite developers call 'good'
>>> indexes': remove unnecessary columns.
>>> (In the sqlite implementation they are already unique via the hidden rowid)
>>> But I would also like to recommend/ask that we start bundling Sqlite with
>>> Subversion, to allow optimizing for the specific version we use for a
>>> release without risking future breakage.
>> You realize that if we do that, we also have to provide a sqlite
>> command-line tool based on that same version.
* Developers need it for debugging the working copy
* Administrators (and probably users) might need it in order to
produce useful bug reports
We don't often get WC-related bug reports that require looking into the
database, but when we do, we may as well get the best possible results.
FWIW, building an amalgamated sqlite3 binary is trivial; the
amalgamation contains source for that.
> Users should have no need to look into our wc.db file, and if they want they can still use any compatible sqlite version. We don't promise performance on their code that peeks in our database.
If we start playing around with indexing tricks that rely on some
particular version of SQLite, you can't be sure that whatever the user
has installed will show correct results.
> We don't deliver sqlite3.exe on Windows, do we?
We don't deliver binaries, so I'm going to ignore this argument as
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
Received on 2013-11-17 15:18:53 CET