On Thu, Jul 6, 2017 at 2:49 PM, Simon Slavin <slav...@bigfraud.org> wrote:

> On 6 Jul 2017, at 12:32pm, Dominique Devienne <ddevie...@gmail.com> wrote:
> > Actually not that much apparently.
> > No Simon, I didn't have an index on code_type.
> > In fact keys is itself a view, and cote_type a case expression.
>
> The index you created is not helpful.  It is not useful for what you’re
> doing.
>

You what evidence do you get that from?

The new plan uses the index though, as I previously indicated, so I'm
surprised you'd say that.

It's a group-by query, so despite using the index, all rowids for the only
4 different "index entries" must still be counted,
and that's still definitely longer to do that than full scanning the table
once.


> I suggest you remove the VIEW layer from your layered query, then
> reconsider what indexes might be helpful.  We can advise you on indexes if
> you post the resulting query.


I don't see how that would make the query any faster. The plan already
shows it scan the "real" table, not the intermediate view (w/o the index
that is). --DD
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to