The most likely way to speed things up is to batch commit to the log,
only committing a transaction after 10 actions or such. The slowness
you are experiencing is writing to disk, which only happens on commit.
It's probable that committing 10 inserts would take the same amount of
time as committing 1 insert. So, for 10 actions, each taking 1ms, you
would have 10.4ms. That means however, that you lose some of the
data(up to 10 log items) if there is a power outage, or your program
crashes.

Databases do not write data faster than plain text files. They have
more complicated mechanisms than plain text files, especially when
compared to something like a log file. You pay in performance for the
features of a database, such as the ACID properties(most of which do
not benefit a log file), and the ability to use sql to query data. If
you're worrried about .2ms, it may be a better idea to use the log
file. You can then write something to parse the log file into a
database, post-execution.

John LeSueur

On 1/13/06, CARTER-HITCHIN, David, FM <[EMAIL PROTECTED]> wrote:
> Yes - although I executed each of those statements individually, e.g.:
>
> Exec SQL1: begin tran
> Exec SQL2: insert into...
> Exec SQL3: commit tran (if rc good from SQL2) or "rollback tran" otherwise.
>
> Cheers,
>
>
> David Carter-Hitchin.
> --
> Royal Bank of Scotland
> Interest Rate Derivatives IT
> 135 Bishopsgate
> LONDON EC2M 3TP
>
> Tel: +44 (0) 207 085 1088
>
>
> > -----Original Message-----
> > From: Manfred Bergmann [mailto:[EMAIL PROTECTED]
> > Sent: 13 January 2006 11:28
> > To: sqlite-users@sqlite.org
> > Subject: Re: [sqlite] SQLite -- Very Slow -- ??
> >
> >
> > What do you mean by wrapping into a transaction?
> >
> > Doing something like this? :
> > BEGIN TRANSACTION;
> > exec Sql-Statement
> > COMMIT TRANSACTION;
> >
> >
> > regards,
> > Manfred Bergmann
> >
> >
> > Am 13.01.2006 um 22:15 schrieb CARTER-HITCHIN, David, FM:
> >
> > > I had similar issues with inserts and solved them by wrapping the
> > > insert
> > > into a transaction.
> > >
> > > Regards,
> > >
> > > David Carter-Hitchin.
> > > --
> > > Royal Bank of Scotland
> > > Interest Rate Derivatives IT
> > > 135 Bishopsgate
> > > LONDON EC2M 3TP
> > >
> > > Tel: +44 (0) 207 085 1088
> > >
> > >
> > >> -----Original Message-----
> > >> From: khaldoun kassem [mailto:[EMAIL PROTECTED]
> > >> Sent: 13 January 2006 11:00
> > >> To: sqlite-users@sqlite.org
> > >> Subject: [sqlite] SQLite -- Very Slow -- ??
> > >>
> > >>
> > >> Hi To All
> > >> I am new to the list
> > >>
> > >> In fact i had a logging system (to log errors and messages),
> > >> for my application using text file, but its very slow.
> > >>
> > >> I tried SQlite, and its slower than the text file, is it normal??
> > >>
> > >> I do the folowing :
> > >>
> > >>
> > >> //Creating the db file
> > >>     int rc;
> > >>     rc = sqlite3_open(sFileName, &m_pSqliteDb);
> > >>     if( rc ){
> > >>         sqlite3_close(m_pSqliteDb);
> > >>         m_pSqliteDb=NULL;
> > >>         return;
> > >>     }
> > >>
> > >>     rc = sqlite3_exec(m_pSqliteDb,"CREATE TABLE LOGS(L_ID
> > >> INTEGER PRIMARY
> > >> KEY,L_PROCESS INTEGER, L_THREAD INTEGER,L_MESSAGE TEXT,L_DATE
> > >> TIMESTAMP)",
> > >> 0, 0, 0);
> > >>
> > >> adding a log:
> > >>
> > >>         rc = sqlite3_exec(m_pSqliteDb,"INSERT INTO
> > >> LOGS(L_PROCESS,L_THREAD,L_MESSAGE,L_DATE)
> > >> VALUES(nProc,nThread,'sMessage',date('now'))", 0, 0, 0);
> > >>
> > >> it works, but its very slow?
> > >> is this normal
> > >>
> > >> Thank you
> > >>
> > >> Kh.K
> > >>
> > >
> > >
> > >
> > **************************************************************
> > ********
> > > *************
> > > The Royal Bank of Scotland plc. Registered in Scotland No 90312.
> > > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
> > > Authorised and regulated by the Financial Services Authority
> > >
> > > This e-mail message is confidential and for use by the
> > > addressee only. If the message is received by anyone other
> > > than the addressee, please return the message to the sender
> > > by replying to it and then delete the message from your
> > > computer. Internet e-mails are not necessarily secure. The
> > > Royal Bank of Scotland plc does not accept responsibility for
> > > changes made to this message after it was sent.
> > >
> > > Whilst all reasonable care has been taken to avoid the
> > > transmission of viruses, it is the responsibility of the
> > recipient to
> > > ensure that the onward transmission, opening or use of this
> > > message and any attachments will not adversely affect its
> > > systems or data.  No responsibility is accepted by The Royal
> > > Bank of Scotland plc in this regard and the recipient should carry
> > > out such virus and other checks as it considers appropriate.
> > >
> >
> > >                                          Visit our websites at:
> > > http://www.rbs.co.uk/CBFM
> > > http://www.rbsmarkets.com
> > >
> >
> > >
> > >
> > **************************************************************
> > ********
> > > **********
> > >
> >
> >
> >
> >
> >
> >
> > ___________________________________________________________
> > Telefonate ohne weitere Kosten vom PC zum PC:
> > http://messenger.yahoo.de
> >
>
>
> ***********************************************************************************
> The Royal Bank of Scotland plc. Registered in Scotland No 90312.       
> Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
> Authorised and regulated by the Financial Services Authority
>
> This e-mail message is confidential and for use by the
> addressee only. If the message is received by anyone other
> than the addressee, please return the message to the sender
> by replying to it and then delete the message from your
> computer. Internet e-mails are not necessarily secure. The
> Royal Bank of Scotland plc does not accept responsibility for
> changes made to this message after it was sent.
>
> Whilst all reasonable care has been taken to avoid the
> transmission of viruses, it is the responsibility of the recipient to
> ensure that the onward transmission, opening or use of this
> message and any attachments will not adversely affect its
> systems or data.  No responsibility is accepted by The Royal
> Bank of Scotland plc in this regard and the recipient should carry
> out such virus and other checks as it considers appropriate.
>                                                                               
>                                  Visit our websites at:
> http://www.rbs.co.uk/CBFM
> http://www.rbsmarkets.com
>                                                                               
>                          
> ********************************************************************************
>
>

Reply via email to