![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have defined a view from table WHERE Afield >= 5 When I run a single EXPLAIN SELECT * from TableView, it recomends to use as possible key Afield but it uses filesort |
|
How can I define the view in order to use a previously created table index by Afield ? something like USE INDEX or FORCE INDEX |
#3
| |||
| |||
|
|
"CENTRINO" <none (AT) nonelandia (DOT) com> wrote: I have defined a view from table WHERE Afield >= 5 When I run a single EXPLAIN SELECT * from TableView, it recomends to use as possible key Afield but it uses filesort This is inconsistent. This WHERE does not require sorting. And in general sorting is not an alternative to using an index. How can I define the view in order to use a previously created table index by Afield ? something like USE INDEX or FORCE INDEX You cannot. If you want control over index usage, don't use VIEWs. XL |
#4
| |||
| |||
|
|
Thanks Axel, but what a dissapointment !!! Views are one of the most important features in a relational system !! |
|
My particular wish list for MYSQL: - Virtual or calculated colums in views |
|
- Indexes for views .... |
#5
| |||
| |||
|
|
Thanks Axel, but what a dissapointment !!! Views are one of the most important features in a relational system !! They reduce developement effort and inprove final user hability to extract data. My particular wish list for MYSQL: - Virtual or calculated colums in views - Indexes for views .... |
#6
| |||
| |||
|
|
You can certainly have calculations in a view ... all you have to do is to alias the column name. |
#7
| |||
| |||
|
|
Any column in a VIEW is virtual, so to speak. ....... If you need indexes on the view as such, then you have to materialize it. |
![]() |
| Thread Tools | |
| Display Modes | |
| |