Set up Mergado effectively #3: The IN operator is better than OR

One of the most common tasks in Mergado is to find products that a user connects to a group he needs to work with. Intuitively, this is done with any number of OR conditions. But we have a more effective way for you. With its help, you will not slow down the performance of Mergado.

One of the most common tasks in Mergado is to find products that a user connects to a group he needs to work with. Intuitively, this is done with any number of OR conditions. But we have a more effective way for you. With its help, you will not slow down the performance of Mergado.

Use the IN operator

Even though the way of searching for items using the OR conditions is absolutely fine, it will take a long time for a large number of such a query.

[PARAM|Size] = “L” OR [PARAM|Size] = “XL”

An example of using the OR operator to find L or XL size T‑shirts.

To prevent this slowdown, use the IN operator.

In Mergado, in addition to the IN operator, the NOT IN negation (not included in the enumeration or any set) is used. So if we do not want these products, the search would be done using NOT IN:

ITEM_ID NOT IN (“1”; “5”; “30”; “50”)

Use enumeration searches using the IN operator. Data will regenerate faster, and you will not slow down Mergado’s performance with hundreds of values.

You could be also interested in:

Lukáš Horák

Lukáš takes care of most of the Czech and English communication in Mergado. Through blogs, e‑mail, and social networks, he regularly supplies readers with e‑commerce news and news and tips from Mergado. In his time off, he enjoys simple things like badminton, digging the hidden gems of the 80’s, and seafood served with red wine.