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

Robert Citek wrote:
>> A considerable amount of time in your test script is actually spent in print
>> calls to pipes.
> 
> I don't follow.  An unordered query takes 3 seconds while an ordered
> query takes 99 seconds.  Are you saying the sorting process is
> printing to pipes behind the scenes?

Your script does that for each output (piping the lines into wc -l).  This
introduces noise into your results since filling the pipe causes the sender
to block.  The SQLite shell is also having to format each line - something
sort does not do. Obviously the order of magnitude time differences mean the
sort internals are still different enough.

You can use the explain command to see what SQLite is doing behind the
scenes.  Use ".explain on" followed by "explain select ...." - ie prefix
your query with "explain".  You can see that without an index the data is
all copied to a temporary table that is then sorted as an example.  You can
make the temp tables be memory based rather than disk based with a pragma.

  http://www.sqlite.org/opcode.html

Roger

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

iEYEARECAAYFAksthbwACgkQmOOfHg372QTYxQCg4aaQ+UCzcI9LJwhov54xdPKg
+BgAoMh7x9GwzPTm/bHNi5k9Dye8IUUl
=Y3jz
-----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