So basically, I'm selecting multiple columns from multiple views (18 columns and 8 views to be exact). The total runtime is roughly 36 minutes. I tried cleaning up everything to make it more readable, but now it's taking even longer; 50 minutes and going.
Here's a sample of what's going on:
SELECT (18 columns)
-- different cases happening here
FROM view1 m
left join view2 dep on --something
inner join view3 c on --something
inner join view4 cl on --something
inner join view5 cc on --something
inner join view6 cp on --something
inner join view7 mp on --something
inner join view8 ma on --something
I'm just trying to get my columns but they are coming from several different places. Is there any way to make this faster? Is creating a temp table necessary? And if so, how should I implement it which would increase the query speed?
Thank You.
jQueryquestion. 2) What are the indexes on the tables?