At the moment EXPLAIN gives me a very small number of rows
for all the queries (thanks to indexes) a part of this one, so if I
understand correctly ANALYZE is not needed anymore.

Or I can get a speed up executing once in a while?

Regards,
Paolo


On Sat, May 11, 2013 at 1:06 PM, Clemens Ladisch <clem...@ladisch.de> wrote:
> Paolo Bolzoni wrote:
>> sqlite> explain query plan SELECT id FROM tour LIMIT 1;
>> 0|0|0|SCAN TABLE tour USING COVERING INDEX tour_unsorted_path_idx
>>                                                     (~1000000 rows)
>>
>> I am not still sure I understand completely the output of explain
>> query plan.
>
> It means that SQLite estimates that the table (or its index) contains
> about 1000000 rows.
>
> The LIMIT clause is *not* used for this estimate.
>
>> To get this simple result, sqlite3 actually scans the whole
>> table?
>
> No.  Without the LIMIT, the query would scan the entire index.  With the
> LIMIT, the scan is stopped after the first row.
>
>> I just have a question about query written in the begin, in my
>> application I use it to know if a table is empty. I execute it
>> and just use sqlite3_step return value. Errors a part, if it is
>> SQLITE_DONE the table is empty, if it is SQLITE_ROW it is not.
>
> This is more a documentation than an optimization improvement, but if
> you are not interested in the value of any particular column, you should
> not request it in the first place; i.e., use something like:
>   SELECT 0 FROM tour LIMIT 1;
>
>
> Regards,
> Clemens
> _______________________________________________
> 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