Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Index a View in SQLite

Tags:

sqlite

Is there any way I can build an index for a view in SQLite?

like image 708
Miguel Avatar asked Oct 28 '10 14:10

Miguel


2 Answers

This thread from a frequent online SQLite commenter says no:

>Hi
>
>May I know if we can create index on a View?

You can't create an index on a VIEW.
A VIEW can be seen as a stored SELECT statement. 

>Thanks in advance.
>wying
-- 
( Kees Nuyt
)
like image 96
Steve Townsend Avatar answered Oct 04 '22 00:10

Steve Townsend


Accessing a view will use the indexes defined on the underlying tables in the view, if those indexes meet the selection and filtering criteria.

So, even though you cannot define an index on a SQlite view, table indexes may still be appropriate.

like image 23
Mitch Wheat Avatar answered Oct 03 '22 23:10

Mitch Wheat