Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I basically agree with <a href="https://stackoverflow.com/questions/77726/xml-or-sqlite-when-to-drop-xml-for-a-database#77750">Mitchel</a>, that this can be highly specific depending on what are you gonna do with XML/sqlite. For your case (cache), it seems to me that using sqlite (or other embedded dbs) makes more sense.</p> <p>First I don't really think that sqlite will need more overhead than XML. And I mean both development time overhead and runtime overhead. Only problem is that you have a dependance on sqlite library. But since you would need some library for XML anyway it doesn't matter (I assume project is in C/C++).</p> <p><strong>Advantages of sqlite over xml:</strong></p> <ul> <li>everything in one file,</li> <li>performance loss is lower than XML as cache gets bigger,</li> <li>you can keep feed metadata separate from cache itself (other table), but accessible in the same way,</li> <li>SQL is probably easier to work with than XPath for most people.</li> </ul> <p><strong>Disadvantages of sqlite:</strong></p> <ul> <li>can be problematic with multiple processes accessing same database (probably not your case),</li> <li>you should know at least basic SQL. Unless there will be hundreds of thousands of items in cache, I don't think you will need to optimize it much,</li> <li>maybe in some way it can be more dangerous from security standpoint (SQL injection). On the other hand, you are not coding web app, so this should not happen.</li> </ul> <p>Other things are on par for both solutions probably. </p> <p>To sum it up, answers to your questions respectively:</p> <ol> <li><p>You will not know, unless you test your specific application with both backends. Otherwise it's always just a guess. Basic support for both caches should not be a problem to code. Then benchmark and compare.</p></li> <li><p>Because of the way XML files are organized, sqlite searches should always be faster (barring some corner cases where it doesn't matter anyway because it's blazingly fast). Speeding up searches in XML would require index database anyway, in your case that would mean having cache for cache, not a particularly good idea. But with sqlite you can have indexing as part of database.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload