php - Any way to optimize this mysql query? -


I do this query is that I use Grup_ CONCAT, or an angel good way to capture the data, so I am very I take interest. I then blast it in, and put an ID / name in an array, and then use one for loop to echo out them.

  select mov_id, mov_title, group_concat (different categories.cat_name) as as as all_genres, All_actyl_id, all_actor_ids, mov_desc, mov_added, GROUP_CONCAT (DISTINCT cat_id), all_genres_ids , GROUP_CONCAT (DISTINCT case when gen_dominant = 1 then gen_catid else 0 end) join as dominant_genre_ids, GROUP_CONCAT (DISTINCT actors.act_name) as all_actors, GROUP_CONCAT (DISTINCT actors.act_id) Muvfon movies from movie _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ '_' _ '_' _ '_' _ '_' _ '_' .gen_movieid side lEFT JOIN on categories _genres.gen_catid = categories.cat_id lEFT JOIN _actors left (movies.mov_id = _actors.ac_movid) (_actors.ac_actorid = Actors.act_id and act_famous = 1) Join Directors on Left Movies.mov_director = directors.dir_id Join movies.mov_rating = movie_ratings.mrate_id Left movie_ratings on the left Join actors on mov_id = ep_showid and ep_season = 0 and ep_num = 0 Where mov_id = * MOVIE_ID * and mov_status = 1 group mov_id by episodes jOIN  

explain query here

Personally, I will try to break the query in multiple queries. Mostly I recommend the removal of the actor and the style so that you can be connected to those groups. Then take separate inquiries to pull out this data. Not sure it will accelerate things, but maybe it's worth a shot.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -