sql - How can I optimize this query...? -


I have two tables, one of the routes is another for airports.

There are only 9000 rows in the routes and I have indexed each column. There are only 2000 rows in the airports and I have also indexed each column.

When I run this query, it may take up to 35 seconds to return 300 lines in:

  SELECT routes. *, The original_name as A1.name, destination_name as a2.name, a1.IATA = routes on AF airports a1. Join the left A2 at the airport a2.IATA = routes.destination WHERE path_build.carrier = "Career name"  

Running with "Descrip", I receive follow-up information , But I'm telling this what it's telling me, it's not 100%.

  id Choose type. Table | Type | Possible_Keys | Key | Key_Len | Referee | Rows | Apart from ------------------------------------------------- -------------------------------------------------- ----------------------------------- 1 | Simple | Routes_build | Referee | Carrier, carrier_2 | Carrier 678 | Constant | 26 | Where to use ---------------------------------------------- - ------------------------------------------------ - ------------------------------------ 1 | Simple | A1 All | Faucet Faucet Faucet Faucet 538 9 -------------------------------------------------- -------------------------------------------------- ---------------------------------- 1. Simple | A2 All | Faucet Faucet Faucet Faucet 538 9 -------------------------------------------------- -------------------------------------------------- ----------------------------------  

The only option I can do Think about how to run two different questions and include them with PHP, though, I can not believe something like that which can kill a mysql server, as always, I suspect that I'm stupid I'm doing SQL my number is weakness I

Personally, I'm left Udne will start removing adding the same interior as it should be close to each route a start and end point.


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? -