yoky wrote:
> Hi all,
>       I create a table with 200 columns, then use sqlite3_prepare() and
> sqlite3_step()to get a record by this: "select * from tbl where ID =.. ".
> Test in my
> embedded system,The total time is about 65ms,it is too long for the
> performance
> requirement, I found sqlite3_prepare() time is about 50ms.
>      Then test the code with VTune,I found lookupName() function in Sqlite
>  take about 50% of the total time, and sqlite3StrICmp() occupied  most
> execution time
> (867/922, see the follow pics ) in lookupName().
>       The follow is  the graph info link generated by VTune:
>    http://img15.tianya.cn/photo/2008/11/18/10872206_2807293.jpg
>    http://img15.tianya.cn/photo/2008/11/18/10872205_2807293.jpg
>        If  use "select * from tbl where...." ,tbl is a table with 200
> columns,
> sqlite3StrICmp() will be executed more than  20000 times inlookupName(),
>  this is the main bottleneck  in sqlite3_prepare().
>        I think maybe Sqlite should do a special optimization for "select *
> from tbl .......",
> and  there is no necessary to compare the column names expanded by "*" with
> the table
> column names.
>       Are there some efficient ways to get a whole record with many many
> columns ?

the functions you are looking for are sqlite3_reset and sqlite3_bind*

Prepare the query just once.  Use bound variables to change the id you
are looking up.  Use _reset to release any locks when not running the query.

--
Ian
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to