Re: [sqlite] db vs shell

2008-08-10 Thread Vitali Lovich
Careful when using time. The bash built-in called time times 1 shell statement (including pipes). The binary in /usr/bin/time only times the command given - it does not span pipes. [EMAIL PROTECTED] wrote: > On Tue, Jul 29, 2008 at 02:15:54AM -0500, Robert Citek wrote: > >> Are you sure

Re: [sqlite] db vs shell

2008-07-29 Thread Ken
to consume approximately the same amount of ram.  Ken --- On Tue, 7/29/08, Stephen Woodbridge <[EMAIL PROTECTED]> wrote: From: Stephen Woodbridge <[EMAIL PROTECTED]> Subject: Re: [sqlite] db vs shell To: "General Discussion of SQLite Database" <sqlite-users@sqlite.or

Re: [sqlite] db vs shell

2008-07-29 Thread Dan
Do things improve any if you increase the temporary cache size? Compile with -DSQLITE_DEFAULT_TEMP_CACHE=100 or something? How much memory does the [sort] process consume in the shell version? What percentage of records are being trimmed by the first [uniq] in the pipeline? Dan. On Jul 29,

Re: [sqlite] db vs shell

2008-07-29 Thread Stephen Woodbridge
I'm seeing a similar speed different with the 3X performance difference: [EMAIL PROTECTED]:~/work$ true && ( set -x > sqlite3 sample.db 'create table bar (foo text)' > seq -w 1 200 | sed 's/^/id/' > list.txt > sqlite3 sample.db '.imp "list.txt" "bar"' > time -p sqlite3 sample.db 'select

Re: [sqlite] db vs shell

2008-07-29 Thread Robert Citek
On Tue, Jul 29, 2008 at 4:25 AM, <[EMAIL PROTECTED]> wrote: > On Tue, Jul 29, 2008 at 03:27:20AM -0500, Robert Citek wrote: >> real 3.25 > .. >> real 22.48 > > I'm seeing the second being twice as -fast- as the first one here, still. I don't follow. 22/3 ~ 7. Or do you mean when you run the

Re: [sqlite] db vs shell

2008-07-29 Thread peter
On Tue, Jul 29, 2008 at 03:27:20AM -0500, Robert Citek wrote: > real 3.25 .. > real 22.48 I'm seeing the second being twice as -fast- as the first one here, still. How many CPU cores are in your testing machine? Parallel execution -might- explain the difference. Cheers, Peter

Re: [sqlite] db vs shell

2008-07-29 Thread Simon Davies
2008/7/29 Robert Citek <[EMAIL PROTECTED]>: > On Tue, Jul 29, 2008 at 2:35 AM, <[EMAIL PROTECTED]> wrote: >> On Tue, Jul 29, 2008 at 02:29:53AM -0500, Robert Citek wrote: >>> $ sqlite3 -version >>> 3.4.2 >> >> On 3.4.0 and 3.5.9 here, the pure-SQL version is -much- faster than the shell >> pipe.

Re: [sqlite] db vs shell

2008-07-29 Thread Robert Citek
On Tue, Jul 29, 2008 at 2:35 AM, <[EMAIL PROTECTED]> wrote: > On Tue, Jul 29, 2008 at 02:29:53AM -0500, Robert Citek wrote: >> $ sqlite3 -version >> 3.4.2 > > On 3.4.0 and 3.5.9 here, the pure-SQL version is -much- faster than the shell > pipe. Could you tell us more about the contents of your

Re: [sqlite] db vs shell

2008-07-29 Thread peter
On Tue, Jul 29, 2008 at 02:29:53AM -0500, Robert Citek wrote: > $ sqlite3 -version > 3.4.2 On 3.4.0 and 3.5.9 here, the pure-SQL version is -much- faster than the shell pipe. Could you tell us more about the contents of your database? Cheers, Peter ___

Re: [sqlite] db vs shell

2008-07-29 Thread Robert Citek
On Tue, Jul 29, 2008 at 2:23 AM, <[EMAIL PROTECTED]> wrote: > On Tue, Jul 29, 2008 at 02:15:54AM -0500, Robert Citek wrote: >> Are you sure time ignores everything after the pipe? > > Seems to depend on shell version - when I tested it here it definitely > ignored everything after. Yours seems to

Re: [sqlite] db vs shell

2008-07-29 Thread peter
On Tue, Jul 29, 2008 at 02:15:54AM -0500, Robert Citek wrote: > Are you sure time ignores everything after the pipe? Seems to depend on shell version - when I tested it here it definitely ignored everything after. Yours seems to do the right thing, which makes your sqlite issue an interesting

Re: [sqlite] db vs shell

2008-07-29 Thread Robert Citek
On Tue, Jul 29, 2008 at 1:31 AM, <[EMAIL PROTECTED]> wrote: > On Tue, Jul 29, 2008 at 01:26:54AM -0500, Robert Citek wrote: >> Why the difference in time? > > Your first test is only measuring how long sqlite needs to 'select foo from > bar'; > all the commands after the pipe are ignored by

Re: [sqlite] db vs shell

2008-07-29 Thread peter
On Tue, Jul 29, 2008 at 01:26:54AM -0500, Robert Citek wrote: > Why the difference in time? Your first test is only measuring how long sqlite needs to 'select foo from bar'; all the commands after the pipe are ignored by 'time'. Try this: time -p sh -c "sqlite3 sample.db 'select foo from bar ;

[sqlite] db vs shell

2008-07-29 Thread Robert Citek
Was doing some DB operations and felt they were going slower than they should. So I did this quick test: $ time -p sqlite3 sample.db 'select foo from bar ; ' | uniq | sort | uniq | wc -l 209 real 5.64 user 5.36 sys 1.51 $ time -p sqlite3 sample.db 'select count(distinct foo) from bar ; '