You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <d....@daniel.shahaf.name> on 2011/07/14 04:53:52 UTC

sqlite3 timing

>From my shell session:

[[[
% time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size FROM rep_cache;" > /dev/null
sqlite3 foo.db  > /dev/null  12.72s user 0.69s system 98% cpu 13.575 total

% time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size FROM rep_cache;" > /dev/null
sqlite3 foo.db  > /dev/null  12.56s user 0.94s system 99% cpu 13.561 total

% time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size, COUNT(*) FROM rep_cache;" > /dev/null
sqlite3 foo.db  > /dev/null  2.76s user 0.72s system 99% cpu 3.492 total

% time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size, COUNT(*) FROM rep_cache;" > /dev/null
sqlite3 foo.db  > /dev/null  2.79s user 0.69s system 99% cpu 3.498 total

% time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size FROM rep_cache;" > /dev/null          
sqlite3 foo.db  > /dev/null  12.62s user 0.75s system 99% cpu 13.430 total

% sqlite3 -version
3.7.4
]]]

That is: adding COUNT(*) to the query makes it 3.9 times faster.

Huh?  How does that make sense?  Should we do anything differently in
our code in light of this?


[ This isn't a fabricated example --- this is the query I added to
rep-cache.c today ]

Re: sqlite3 timing

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Nothing to see here.  (The syntax I used doesn't have the semantics
I expected it to have.)

Daniel Shahaf wrote on Thu, Jul 14, 2011 at 05:53:52 +0300:
> From my shell session:
> 
> [[[
> % time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size FROM rep_cache;" > /dev/null
> sqlite3 foo.db  > /dev/null  12.72s user 0.69s system 98% cpu 13.575 total
> 
> % time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size FROM rep_cache;" > /dev/null
> sqlite3 foo.db  > /dev/null  12.56s user 0.94s system 99% cpu 13.561 total
> 
> % time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size, COUNT(*) FROM rep_cache;" > /dev/null
> sqlite3 foo.db  > /dev/null  2.76s user 0.72s system 99% cpu 3.492 total
> 
> % time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size, COUNT(*) FROM rep_cache;" > /dev/null
> sqlite3 foo.db  > /dev/null  2.79s user 0.69s system 99% cpu 3.498 total
> 
> % time sqlite3 foo.db "SELECT hash, revision, offset, size, expanded_size FROM rep_cache;" > /dev/null          
> sqlite3 foo.db  > /dev/null  12.62s user 0.75s system 99% cpu 13.430 total
> 
> % sqlite3 -version
> 3.7.4
> ]]]
> 
> That is: adding COUNT(*) to the query makes it 3.9 times faster.
> 
> Huh?  How does that make sense?  Should we do anything differently in
> our code in light of this?
> 
> 
> [ This isn't a fabricated example --- this is the query I added to
> rep-cache.c today ]