On Mon, 29 Sep 2008 12:14:42 -0700 (PDT), devesh tiwari <[EMAIL PROTECTED]> wrote in <sqlite-users@sqlite.org>:
>I am not seeing this performance difference in write >but in reading database. Following is the sequence >i am performing for reading: > >1. sqlite3_open() >2. sqlite3_prepare() >3. sqlite3_bind_int() >4. sqlite3_step() >5. sqlite3_column() >6. sqlite3_finalize() >7. sqlite3_close() > >steps 1, 2, 6 & 7 are done only once and i am also >doing sqlite_reset() before i use sqlite3_bind_int() >again to create a query. > >the query is always of the form: >select column from table where index='index_no'; >so i need to change table name and index_no only for the next query. As far as I know, the table name cannot be variable, so you will need an sqlite3_prepare() for every table you want to query. A few other remarks: INDEX is a reserved word, so ``where index='index_no'`` is not valid, but you probably meant to say something like ``where keycolomn='index_no'``. If index_no is a numeric value, you need to define keycolumn as a NUMERIC type and drop the quotes around the value in all SQL statements that refer to it. Make sure you define an index on keycolomn, or make it the primary key, as in: CREATE TABLE sometable ( keycolumn INTEGER PRIMARY KEY NOT NULL, valcolumn TEXT ); >If i dont use sqlite than sequence of reading is: > >1) open file >2) seek in the file(seek value is simply calculated as index*size_of_structure) >3) read >4)close file > >In this case file is opened once and only steps 2 & 3 need to >perform for reading data and this is 10 times faster than sqlite. > >Thanks & Regards >Devesh Kumar Tewari (Please don't quote a full digest, but rather just the post you reply to.) -- ( Kees Nuyt ) c[_] _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users