On 2016/09/07 4:20 PM, Laura BERGOENS wrote:
Hi Mr. Slavin,

As for why the query takes so long, I do know the answer !
Long story short, my application does a lot of calculation and things, I
don't want to get into the details here, but queries are built and
auto-generated piece by piece. Therefore, sometimes the queries aren't
optimized at all.
I solved that issue myself by touching up the queries a bit before
executing them, and everything is fine now.
I was concerned mainly because I figured that maybe some queries were a bit
longer to execute as they should have (let's say 200 ms instead of 100 ms),
and I'm running a lot of queries in the app (approx 1000 per seconds).

Magic goalposts...

"A query" taking 100s is a VERY VERY different problem to 1000 queries taking 100ms each. And to get technical, you shouldn't really need to optimize the queries (apart from avoiding the obvious silliness), you only need to know how to ask for the data correctly. Optimization is the job of the query planner in the DB engine - it should get the best fastest query results possible as long as it has all the information (which is what ANALYZE will do as others mentioned already) and as long as you provide the best Index for the job (which is something we might have some suggestions on if we know the schema and typical query is).


I know now that there is nothing to worry about regarding my settings or
pragmas choices, since I get the same execution time with the sqlite3 tool

Maybe nothing to worry about, but that is no reason to leave it be - whatever the case is, if some previous version of SQLite can run it in 1/10th the time, there MUST be opportunity for improvement.

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

Reply via email to