View Full Version : Question About Views, Indexes and Query Logic

06-07-2011, 03:12 AM
So I just have a question about how I should be writing the query statement behind views. If I am writing a view, I was wondering if it makes any difference when performing an INNER JOIN if I join from the root tables containing the data, or from another view, that also has the data I am after.

Sometimes it is more direct to just pull directly from another view, but from an efficiency standpoint, is it less efficient. I was just looking through my database status, and under "The number of joins that do not use indexes." I am not showing '8'. I don't think there were any yesterday, and I just wrote a view that utilizes another view. If this is my problem, how big of a problem is it, or how much will it affect query speed. The view could potentially become fairly large, easily greater than 5000 individual rows. Do I need to worry about how I have written the view?

06-07-2011, 05:54 AM
5000 rows is insignificant. Run an EXPLAIN on your query to see what indexes, if any, are being used.