[Trac] Why does Trac use SQLite for Wiki?

Jonas Borgström jonas at edgewall.com
Sun Aug 15 14:57:31 UTC 2004
Alik Eliashberg wrote:

> Hello,
> 
> I just started looking at Trac and it looks very interesting.
>>From playing with it (for a whole of a day), I have a quick "design" question
> - why does Trac use SQLite to store version information of the Wiki? It would
> seem that since Trac is tightly integrated with Subversion, it should us it
> for Wiki as well (e.g. create a separate subversion repository somewhere in
> the trac project directory).
> 
Trac is even more tightly integrated with sql(ite). The timeline uses a
simple sql query to collect recent changes from all different trac
modules and the report system is simply built around sql queries. The
same goes for searching...

> With current use of SQLite, having a dynamic wiki (one that changes
> frequently) becomes very space-expensive - every time a document is changed,
> it is completely duplicated in another entry of 'wiki' table. For example, if
> you assume that a discussion is happening over wiki, with every person adding
> a roughly equally sized chunks of text, the space use becomes O(n!), instead
> of O(n) with a version control system that only saves the differences.
> 
That's true but with the cheap disc drives of today it's quite hard to
motivate using a much more complicated approach just to save a few
kilobytes of disc space.

> Second (and unrelated) question is why does Trac use SQLite for its internal
> storage? Given that it is closely tied to Subversion, and subversion uses
> BDB, wouldn't it make sense to build Trac on top of BDB as well - that would
> save the administrator need to learn operation, backup, and recovery of two
> different database systems. Python bindings for DB4 do exist
> (pybsddb.sourceforge.net) (although I never used them) and it would appear
> that all functionality of SQLite is supported by DB4. What's the catch?
> 
What? Berkeley db is just a key-value database with transaction support.
It would be extremely difficult to replace all sql code in Trac with
a bdb backend.

/ Jonas
-- 
Jonas Borgström    | Edgewall Software
jonas at edgewall.com | Professional GNU/Linux & Open Source Consulting.
                    | http://www.edgewall.com/