tags:

views:

19

answers:

2

Good afternoon,

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

Thank you very much.

+2  A: 

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.

Mitch Wheat
Yes, but in this case the statement`SELECT Something FROM (Table1 JOIN Table2 ON Something) WHERE (Field = 'text')`runs a lot faster than subsituting the join by the view.
Miguel
A: 

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
)
Steve Townsend