Does the order of filter conditions affect performance?

For example, say I have a 10,000-row MOVIE table with RELEASE_DATE and ACTOR columns. Does MOVIE.filter(DATE = today() AND ACTOR = "Christopher Walker") always perform the same as MOVIE.filter(ACTOR = "Christopher Walker" AND DATE = today())?

Thanks!

1 Like

Dear @DSB

There must be a reason, bigger then just curiosity?

:bulb: Not easy to say, with this limited amount of information and making clear if you will filter in the table on the screen or with a button!

In the sample above I suggest that by filtering out first the date and then the actor it will go faster, as there is only one line with that date.
If you filter first the actor (3 instances) and then to search from the 3 instances the today’s date, will take slightly more time. (especially when you filter on the table, you could see a visible delay in bigger tables)

My logic says, on one day an actor can have released only 1 movie, while one actor has most probably many movie release dates

Curious too for more in dept feedback from others in this community?

1 Like

Yeah I don’t know the exact perf differences of Today() date comparisons vs text matches, but the answer to your overall question is yes, filter order matters, and you should try to do highly performant comparisons (e.g. true/false values) ahead of more complex comparisons, because Coda will be smart and short circuit the rest of the comparison once the first part isn’t a match.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.