[Tutor] More and more OT - Python/Java

Yigal Duppen yduppen at xs4all.nl
Wed Jan 12 10:23:00 CET 2005


On Wednesday 12 January 2005 09:40, Alan Gauld wrote:
> > I ask that because I'm writting a little program that will make
> > queries over a 1500 entries database, with very simple queries. I
>
> need
>
> > an answer in 1 or 2 seconds. I'm using SQLite now, but i wanted
> > something that depends as little as possible of external
>
> dependencies
>
> > (as a database).
>
> 1500 entries shouldn't be a problem for queries either using DOM
> (in memory) or XPath or even XQuery. If your app grows to 150000
> it might stat to be a problem, and if you get over a million
> entries I'd definitely start thinking about regular RDBMS.
>
> The other feature is that for ~1500 entries the size of the
> files will be about the same but anything bigger than that
> and the XML version will quickly start to fill your disks...

I actually have some realy life experience with using XML files instead of a 
database, and it's a bit of a mixed blessing. 

A big advantage of XML over a relational database is the built-in support for 
hierarchical structuring. When you're mainly reasoning about trees (in this 
particular case, parse trees) the relational solution is a bit... messy. 

For example, to find all assignment statements at the top-level of a function, 
XPath allows you to say something like:
	//function-definition/statement[@type="assign"]
the equivalent is SQL is not so nice. 


On the other hand, the amount of XML our project produced was *huge*, and much 
of the processing time of the project went into parsing XML. Furthermore, 
while XPath allows for very cute queries, no XPath implementation is as 
optimized as SQL. 

All in all, I'd never advise XML as a database.


Yigal


More information about the Tutor mailing list