Access, ODBC and PHP slower with WHERE clause

I have the following query running via DSN via odbc_connect in PHP:

 SELECT Orders.Brand, Orders.AdFolder FROM Orders LEFT JOIN MPC_Agents ON Orders.UserName = MPC_Agents.UserName WHERE Orders.AdFolder = '$udf' 

When launched directly in MS Access, the result is instant. When it went through odbc_execute($conn, $query) , it is incredibly slow, but it does after a while.

When the WHERE pulled out, it is much faster, even though when run in the Access SQL console, the speed is the same as in the WHERE .

Can someone help identify the problem?

+4
source share
1 answer

To prevent the entire table from coming off the query, it’s important that you have the appropriate indexes.

+3
source

Source: https://habr.com/ru/post/1436805/


All Articles