In a simple SELECT query of a single table, using the C API, is there any
difference in performance for requesting more or fewer columns of the table in
the result? Or is the performance penalty only incurred when actually reading
the column values?
For example, lets say a table has 26 columns, some of which can be large
strings/blobs. I prepare two statements:
SELECT a FROM mytable WHERE …
SELECT a,b,c,d,…,z FROM mytable WHERE …
If I run both of those queries, but in my loop I only read the value of ‘a’, by
calling sqlite3_column_text(stmt, 0), is there any difference in speed?
I am guessing that there isn’t a difference. (I could run tests, but I don’t
want to be dependent on a detail that might change.) If so, this will make it
easier to create my queries, since I won’t have to fine-tune their column sets
based on what columns I need in each different use case.
sqlite-users mailing list