mysql view performance
Posted
by vamsivanka
on Stack Overflow
See other posts from Stack Overflow
or by vamsivanka
Published on 2010-05-03T19:01:12Z
Indexed on
2010/05/03
19:28 UTC
Read the original article
Hit count: 380
I have a table for about 100,000 users in it.
First Case:
explain select * from users where state = 'ca'
when i do an explain plan for the above query i got the cost as 5200
Second Case:
Create or replace view vw_users as select * from users
Explain select * from vw_users where state = 'ca'
when i do an explain plan on the second query i got the cost as 100,000.
How does the where clause in the view work ?? Is the where clause applied after the view retrieves all the rows. Please let know, how can i fix this issue. Thanks
© Stack Overflow or respective owner