Databases

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • SQLite -- Very Slow -- ?

    5 answers - 140 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    I had similar issues with inserts and solved them by wrapping the insert
    into a transaction.
    Regards,
    David Carter-Hitchin.
  • No.1 | | 400 bytes | |

    What do you mean by wrapping into a transaction?

    Doing something like this? :
    BEGIN TRANSACTIN;
    exec Sql-Statement
    CMMIT TRANSACTIN;

    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.
  • No.2 | | 1015 bytes | |

    Hi

    <<What is "slow" or "slower"? >>
    When I run the program without logs an action take 1ms, with logs inserted
    in a text file it takes 1.2ms so its "SLW", and with logs inserted in a
    SQLite DB it takes 1.4ms so its "SLWER" than the text file.

    <<What is the reason for using database in the first place (do you need to
    select information?) >>

    I Try tu use database for 2 reasons :
    1 - because the text file logs was slow, and I thought that database is
    faster than the text file.
    2 - to easily manipulate log files to detect abnormal behaviour

    <<but I cannot see how anyone will be able to give you any useful answer>>
    If you cannot, you cannot said that others cannot.

    thank you

    1/13/06, CARTER-HITCHIN, David, FM <David.CARTER-HITCHIN (AT) rbos (DOT) comwrote:

    I had similar issues with inserts and solved them by wrapping the insert
    into a transaction.

    Regards,

    David Carter-Hitchin.
  • No.3 | | 4018 bytes | |

    Hi Manfred,

    sqlite writes makes sure that each transaction
    ssi written to disk. If you have multiple inserts do

    BEGIN TRANSACTIN;
    while(have_input)
    exec Sql-Statement
    CMMIT TRANSACTIN;

    http://web.utk.edu/%#transaction-wrappers

    You can aslo speed up the time a transaction takes, if
    your can live with potential database corruption
    in case of a power failure:
    http://web.utk.edu/%#pragma-synchronous

    here are a few links about optimization:

    http://web.utk.edu/~

    Michael

    Manfred Bergmann wrote:
    What do you mean by wrapping into a transaction?

    Doing something like this? :
    BEGIN TRANSACTIN;
    exec Sql-Statement
    CMMIT TRANSACTIN;

    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
    >LNDN EC2M 3TP
    >>

    >Tel: +44 (0) 207 085 1088
    >>
    >>

    Message
    From: khaldoun kassem [mailto:khkassem (AT) gmail (DOT) com]
    Sent: 13 January 2006 11:00
    To: sqlite-users (AT) sqlite (DOT) 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 LGS(L_ID
    INTEGER PRIMARY
    KEY,L_PRCESS INTEGER, L_THREAD INTEGER,L_MESSAGE TEXT,L_DATE
    TIMESTAMP)",
    0, 0, 0);

    adding a log:

    rc = sqlite3_exec(m_pSqliteDb,"INSERT INT
    LGS(L_PRCESS,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 : 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

  • No.4 | | 538 bytes | |

    khaldoun kassem wrote:

    >Hi
    >
    ><<What is "slow" or "slower"? >>
    >When I run the program without logs an action take 1ms, with logs inserted
    >in a text file it takes 1.2ms so its "SLW", and with logs inserted in a
    >SQLite DB it takes 1.4ms so its "SLWER" than the text file.


    Is it possible to write to the log in a separate thread, so that the
    0.4ms to write the log entry for one item happens during the 1.0ms for
    handling the next item?
  • No.5 | | 403 bytes | |

    Hi

    <<What is "slow" or "slower"? >>
    When I run the program without logs an action take 1ms, with logs inserted
    in a text file it takes 1.2ms so its "SLW", and with logs inserted in a
    SQLite DB it takes 1.4ms so its "SLWER" than the text file.

    Not to be negative or anything, but you're asking the computer to do more work
    and expecting it go faster?

Re: SQLite -- Very Slow -- ?


max 4000 letters.
Your nickname that display:
In order to stop the spam: 0 + 9 =
QUESTION ON "Databases"

EMSDN.COM