where clause - How do I make my MySQL Qyery with an "IN" statement faster? -


my query runs quite slow. have 2 lare query's on page. has become running slow since have insert "in" statement.

    select field1, field2, field3, field4, field5, field6,             date_format(field7, '%d-%m') field7_1,             date_format(fjield8, '%d-%m') field8_1                table1             field9 in (select field1 table2 id = '$id_session') or        field10 in (select field1 table2 id = '$id_session')     order         field7_1 desc    limit         50, 100"; 

i think problem part "where field9 in (select field1 table2 id = '$id_session')" searching in table values have in clause.

it taking 8 sec load slow. have reduced number of records in database, not make faster.

please help.

you can refactor queries using in use join instead.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -