[Tutor] Filesystem vs Database vs Lucene

Christopher Arndt chris.arndt at web.de
Mon Mar 26 23:21:31 CEST 2007


Shitiz Bansal schrieb:
> I need to implement a system which stores Strings(average length 50 chars).
> I was wondering what would be the most efficient(timewise) solution for
> this riddle.

I'd use pysqlite, a SQL database in a file.

> For every input String it would need to tell the user wether that string
> already exists in the system.

Create the string column as "UNIQUE".

> It would also need to add that input
> String to the system if it did not exist.

Select the string to be inserted, if there is no result, you can insert the new
string.

> It will also be useful to know
> the last accessed datetime value of that string.

Just add a column with type TIMESTAMP and update that accordingly.

> The number of strings is in millions

Should be no problem with SQLite, if the strings are short.


Chris


More information about the Tutor mailing list