MySQL Forums
Forum List  »  InnoDB

Re: InnoDB engine doesn't honor unique key constraints, under a heavy load
Posted by: Rick James
Date: March 19, 2015 11:47PM

SELECT  ACCESS_TOKEN, AUTHZ_USER, TOKEN_SCOPE, TOKEN_STATE
    FROM  IDN_OAUTH2_ACCESS_TOKEN
    WHERE  CONSUMER_KEY = 'a7ede2ff2ccf4946aa4176ff9577448d'
      AND  REFRESH_TOKEN = '0f972d6fea304c5ea15e325941a97666'
    ORDER BY  TIME_CREATED DESC
    LIMIT  1
begs for
INDEX(CONSUMER_KEY, REFRESH_TOKEN, TIME_CREATED)
In that order. Or you could swap the first two columns.

The FOREIGN KEY constraints requires that the column be UNIQUE in the _other_ table.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.