dotConnect for Magento Documentation
SQL Translation

dotConnect for Magento can translate a subset of SQL-92 SELECT statements to the corresponding Magento API calls for remote execution. As remote execution provides much higher performance than local one, it makes sense to use SELECT statements that are translatable to API Calls.

SELECT statements that correspond to the following pattern and conditions can be converted to API calls and executed remotely:

SELECT result_columns FROM table [WHERE where_condition]  

If a SELECT statement contains any of the features, not explicitly mentioned above, it cannot be translated to Magento API calls and by default, it is executed locally, which usually takes more time and resources than remote execution. (Local execution can be disabled completely if necessary - see Select Statement Execution).

Exceptions

If a statement contains any of the exceptions, listed below, it also cannot be translated to the Magento API calls and is executed locally.

Filterable Columns and Allowed Comparison Operators

Magento supports only the following columns with the following comparison operators in the WHERE clause:

Remote Execution Performance Tips

Many objects are retrieved in two steps: first the list of all the object IDs is retrieved, and then their data are read. However, if you specify the object ID in the WHERE clause, the necessary object is read immediately. Thus, specifying the necessary object ID in the WHERE clause speeds up the query execution. It's better to specify the object ID in the WHERE clause for the following objects: Categories, Products, SalesOrders, SalesOrderInvoices, and SalesOrderShipments.

All the columns are actually queried regardless of the column list in the query, and omitting some columns in the SELECT clause does not affect performance.

Many objects depends on the other objects directly, and cannot be retrieved without the ID of the parent entity. In such cases parent objects are read first, and then the queried objects are read by the second request. If the ID of the corresponding parent object will be specified in the WHERE clause, the first step can be omitted, and this improves performance. Here is the list of such objects with the necessary parent ID fields: