HubSpot HubDB 'Maximum Table Scans per CMS Page' Clarification

I have been working on a lot of HubDB integration within Hubspot CMS and wanting to get clarifications on how far HubDB can be used on a page. In the documentation, one of the technical limits states the following:

10 table scans per CMS page. Defined as a single call to hubdb_table_rows()

Does this mean you cannot use hubdb_table_rows() more than 10 times on a single page, or is it based on conditional querying?

For example, if I had a loop where I was calling hubdb_table_rows() and the loop happen to iterate more than 10 times, this would not be allowed?

It is based on 10 actual executions of the function. So a loop would indeed count against that.

HubDB supports storing 10,000 rows per HubDB table. As you can imagine retrieving that much content is a very expensive task. execute that 10 times and you have 100,000 rows of data, in-which the content stored per row could be as large as full cms pages, and often is, as a result of dynamic pages.
We recommend using the JavaScript and hitting the HubDB API in order to get the data. Otherwise you would be hurting your page performance.

Thanks for confirming. I plan on passing a filter query to my executions of hubdb_table_rows() function. Wouldn’t that make things more efficient from a page loading perspective as I am only getting back the rows I require?

What happens if a user adds multiple modules on the page that carries out HubDB interactions?

because all of the rows have to be queried regardless of your filtering it’s not treated differently. I’ve brought it up internally as we do want to make sure you can do what you need to while keeping your site performant.
HubDB queries are tracked per page, so yes usage across different modules will count.
It’s recommended that you use |selectattr and |rejectattr if you’re just trying to filter rows that you’ve already queried on a page.