How to Simplify a Filter
  • 21 Nov 2022
  • 3 Minutes to read
  • Dark
    Light
  • PDF

How to Simplify a Filter

  • Dark
    Light
  • PDF

Article summary

Some filters cannot be updated in real time. In this case, you will see a notification saying: The filter you have built has been running for a long time. Try creating a scheduled segment.

Sometimes, a filter is so complex that the system cannot calculate the segment and displays a notification asking you to "The filter you have built has been running for a long time. Try creating a scheduled segment".

Here’s what you can do to simplify the filter.

If you need to search for customers with orders, try following these steps: go to Database → Customers, click Add condition and go to Actions → Customer action → Orders and product lists → Order → Additional information → First action information instead of selecting Add condition → Actions → Customer action → Orders and products → Order → Order first action:

BeforeAfter
00_simplify_a_filter01_simplify_a_filter

If you need to search for action template categories, select Database → Customers, click Add condition, select Action template → Actions → Customer action → Action template → Category instead of Action template → Name → Category:

BeforeAfter
02_simplify_a_filter03_simplify_a_filter

If you need to search for actions related to a product or product category, select specific action templates to narrow down your search:

BeforeAfter
04_simplify_a_filter05_simplify_a_filter

A search by quantity is more complex than the At least one condition. Therefore, try using the At least one condition instead of Set quantity → From 1:

BeforeAfter
06_simplify_a_filter07_simplify_a_filter

If you’re creating a filter for orders with specific product categories and it’s taking a while to load, try creating a Scheduled or Static segment for these products and add it to your filter:

BeforeAfter
08_simplify_a_filter09_simplify_a_filter

You can also speed up your search for balance updates: add your conditions for the bonus points account, the action template, and / or the period of a relevant update.

You can specify the balance update actions by its name or category:

BeforeAfter
10_simplify_a_filter11_simplify_a_filter

If you need a search for orders placed during a specific timeframe in the Actions tab, go to Database → Actions, click Add condition → Orders and products → Order → Order item → Order → Additional information → First action information:

BeforeAfter
12_simplify_a_filter13_simplify_a_filter

If your filter for actions cannot be created and you cannot simplify it, try filtering using a Scheduled segment for customers with the actions from the initial filter:

BeforeAfter
14_simplify_a_filter15_simplify_a_filter

If a segment cannot be calculated and your filter has multiple conditions, try to determine if there are any particularly difficult ones that may be slowing things down. To do this, apply your conditions one by one:

16_simplify_a_filter

If your filter cannot be calculated, you can add some of its conditions as a Scheduled segment. This is because Scheduled segments are ready-to-use when you add them to the filter.

For more information about the segments that cannot be calculated, please read this article.

Reasons why a filter cannot be calculated

Whether a filter can be calculated or not depends on the three factors:

  • filter conditions;
  • the amount of data that fits these conditions;
  • the database workload volume at the time when you’re creating the filter.

Filter conditions

Let’s take a closer look at this example:

17_simplify_a_filter

To find customers that fit these conditions, the system must filter them in two separate lists: those with orders and those with a subscription that matches the one selected. After that, the system will compare these lists.

The more customers / orders / topics the database contains, the more data will have to be processed by the filter, and therefore the longer it will take for the selection to be completed.

If you add a new condition — for example, First action information — the filter becomes more complex, because it must now search through an additional list of actions and merge the results with the data found at the previous step.

Therefore, the more entities your filter includes and the more data for these entities the database contains, the more complex your filter is.

Volume of data

If a Realtime filter often displays a notification that suggests building a Scheduled segment, this is an indicator that a large volume of data has built up in your project’s database.

18_simplify_a_filter

To help everything work smoother, you can delete some of this data. Actions can be deleted automatically and other entities can be deleted manually.

What happens if you choose not to delete your data?

In this case, please keep in mind that your filters may work slower. Some of them will no longer be updated in real time and you will have to replace them with Scheduled segments.

Database workload

Database resources are limited. Filters share these resources with other features in the system, including messages, triggers, imports and exports, multiple API method calls, etc.

All of these can be quite heavy on the system, which in turn can affect how filters work — so they may be slower during peak hours and speed up when workload volumes from other system operations are lower.