-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ron Arts wrote:
> Using hash tables I can do 100000 requests in .24 seconds
> meaning around 400000 req/sec.

If you are just doing simple lookups (eg doing equality on a single column)
then a hash table will always beat going through SQLite.  But if you are
doing more complex queries SQLite will beat the pants off any custom
expression evaluator you have unless you spend a lot of time optimising it.

> Virtual tables are a partial solution and I tried that, but
> as I said, hash tables are pretty static, and I can't recompile
> (and worse: restart) the application every time some programmer
> adds a database column.

I am confused by this.  Are columns added while running or is this a
development time issue?  Why do virtual tables require a recompile or
restart?  (Hint: you can drop and recreate a table.)

> So I assume there is no direct access method for the im-memory
> table structures?

It uses btrees and there is no stable API to them nor is it exposed in any
way.  See http://www.sqlite.org/arch.html

> Or did you mean that when you said using virtual tables?
> Can I add a hashed index on an existing sqlite memory table this way?

The point of virtual tables is to let you provide a SQL API to your
underlying data without exposing in any way how that data is structured or
optimised.  In the architecture diagram above your code provides the blue
"backend" box.

If all you have at the end of the day is a single simple flat list then this
won't provide much benefit.  If you have multiple lists and need to evaluate
expressions over them then virtual tables are great.  If you have an
underlying index then the virtual table BestIndex method works with them, or
you don't return anything and SQLite will iterate over all relevant rows.

Roger

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrQ7gcACgkQmOOfHg372QSwJACfeOFn8zID4H6veWVxQVXBbxTd
gwYAn1tCdv2tA21Lc5A6oOh7HUhEya5f
=mklT
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to