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

On 07/19/2010 07:50 AM, Sam Carleton wrote:
> How expensive is doing a PRAGMA database_list?

17.

Without context numbers are useless.  The internal implementation involves
traversing data structures and populating the VDBE so that you get the right
answer, so it is mostly changing representation of data from one format to
another.

> Is this very expensive?  

Relative to network and disk i/o, no.

> Normal load is 5 to 50 clients all hitting the server every 1 to 5 seconds.
> One hit could be multiple requests.

That is a trivial load for any machine of the last 10 years.  You could
easily add in some prime calculation or password brute forcing without
breaking a sweat.

In any event by far the best thing to do is get it right and testable first,
which generally means the simplest code possible, and then worry about
optimisation.  That way you'll have a baseline and test code to see if your
optimization broke anything.

Something implied by your approach to this problem is that you can't hook
into the config change system which is what would seem most logical.

Another approach which may work for you is to use the filename as the
attached database name:

  sqlite> attach "/home/rogerb/xx" as "/home/rogerb/xx";
  sqlite> create table "/home/rogerb/xx".foo(x,y,z);

If the filename has " in it then quote using [ and ].

You'll obviously need an error handler that catches SQLITE_ERROR on the
first query and attaches the missing database.  This approach will work if
different attached databases are needed on the same connection for different
queries and saves you the hassle of constantly checking that "eventdb" is
bound to the correct one.

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

iEYEARECAAYFAkxEswQACgkQmOOfHg372QQRiQCfeQnRwSScFzdPmCPcjmPr9zWS
UpIAoN3PKaxQGRYDRkEYUMVJxZF38es3
=wvfZ
-----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