sql - Two left joins and one query to MySQL performance problem -


I am preparing a project for quizzes and quizzes results. So I have two tables: quizz_race and quiz. ID is the primary key of the quiz and quizz_result is the foreign key for foreign identity quizz_id.

The question below is designed to order the date with public information: If the current user (683735) had made this quiz a valid result (> 0) and how many people did this point In time till this question filled up.

So I did this simple query with two left joining:

  Select one. *, COUNT (countt.QUIZZ_ID) from a SUMFILL join a left quizz_result countt on countt.QUIZZ_ID = a.ID on the group by a.ID and  

and quizzed indexes added to these columns: <

  ID, (id, date), public, (public, DATE)  

and on quizz_result: , (QUIZZ_ID, USER_ID), QUIZZ_ID, USER_ID, (QUIZZ_ID, QUIZZ_RESULT_ID)

But even when I query, it looks like about a minute. And I have only 34k rows in the Quasiz table and 120 queues in the quiz table.

When I clarify on this query, I get:

  SELECT TYPE: Simple, Possible Key: IDX_PUBLIC, DATE, Rows: 34 Extra: Where To use; Using Temporary; Select the type of files Select: Simple, Possible Key: IDX_QUIZZ_USER, IDX_QUIZZ_RES_RES_QUIZ, IDX_USERID, I ..., Rows: 1, Extra: Do not select anything here SELECT TYPE: Simple, Possible Key: IDX_QUIZZ_USER, IDX_QUIZ_RES_RES_QUIZZ, ID_RESULT_ID, Rows: 752, Extra: Using Index  

And I do not know what to do to optimize this query. I'm looking at it:

  where to use; Using Temporary; Using the fileort  

But still I do not know how better it is, or what is the number of rows to be selected in the last time? 752?

How can I optimize this query?

EDIT: I have raised this question with only one left joining because it's time to run at the same time.

EDIT2: I removed everything and removed it: 1s with a query to execute this simple selection. How to customize it?

Try to exclude some of those additional conditions from their involvement, they can sometimes get help where The section can sometimes help. Also, consider incorporating the core into its own sub-section and then restricting it with that section.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -