English 中文(简体)
sqlite explain from api
原标题:

I have a complicated SQL query executed from my application. The query runs fine with the version 3.6.11 (64ms). When run in 3.6.22 it takes more than 100 sec to finish. When executed from the command line client, the execution is quick both in 11 and 22. Therefore I want to run the query with "EXPLAIN" from inside my application. Is it possible? I tried to prepare and step the query and then read the column as as text but the result is empty.

Can be "EXPLAIN" executed from my application using C++ API ?

问题回答

According to the SQLite opcode page :

Depending on compile-time options, you can put the SQLite virtual machine in a mode where it will trace its execution by writing messages to standard output. The non-standard SQL "PRAGMA" comments can be used to turn tracing on and off. To turn tracing on, enter:

PRAGMA vdbe_trace=on;

You can turn tracing back off by entering a similar statement but changing the value "on" to "off".

Also, the output from an EXPLAIN ... query is just a (an ordered) set of records that you can decode if you re up to it. See: this SQLite page





相关问题
sqlite3 is chopping/cutting/truncating my text columns

I have values being cut off and would like to display the full values. Sqlite3 -column -header locations.dbs " select n.namelist, f.state, t.state from names n left join locations l on l.id = n.id ...

Entity Framework with File-Based Database

I am in the process of developing a desktop application that needs a database. The application is currently targeted to SQL Express 2005 and works wonderfully. However, I m not crazy about having ...

Improve INSERT-per-second performance of SQLite

Optimizing SQLite is tricky. Bulk-insert performance of a C application can vary from 85 inserts per second to over 96,000 inserts per second! Background: We are using SQLite as part of a desktop ...

Metadata for columns in SQLite v2.8 (PHP5)

How can I get metadata / constraints (primary key and "null allowed" in particular) for each column in a SQLite v2.8 table using PHP5 (like mysql_fetch_field for MySql)? sqlite_fetch_column_types (OO:...

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签