On Sat, Jun 13, 2009 at 1:52 AM, Mike
Borland<mike.borl...@cygnetscada.com> wrote:
> I have a fairly complex program where I am seeing a performance
> degradation of the sqlite3_step() function.  Basically I'm iterating
> roughly 200 rows at a time, over and over.  The only work happening
> during the iteration is I'm copying the record into an array.  At first,
> sqlite3_step() takes less than a millisecond to run.  After 0-50
> iterations, it's taking anywhere from 10-100ms.
>
> Does anybody have any insight into what's happening behind the scenes
> with this function to help me track down the cause?  I appreciate it!

You should explicitly say what your SQL query is. Without that we can
only guess.

My current "psychic" guess is that you are using LIMIT to obtain those
200 rows, one "page" at a time, and as you go advancing "pages" it
becomes slower and slower.
If this is true, then you should re-think your design as LIMIT just
skips the rows, but it will  "generate" them before, meaning it
becomes slower as you advance on the offset given.
Look at http://www.sqlite.org/cvstrac/wiki?p=ScrollingCursor (and
notice the "What not to do" at the end, talking about "LIMIT" and
"OFFSET").

If my my psychic abilities are becoming weak, then please supply your
exact query that is getting slower  (and maybe your database schema)
and then someone can give you an exact answer.


Regards,
~Nuno Lucas

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

Reply via email to