# Query + Rollup causes performance issues

**URL:** <https://community.glideapps.com/t/query-rollup-causes-performance-issues/83228>\
**Category:** Ask for Help\
**Created:** [July 16, 2025, 8:37pm UTC](https://community.glideapps.com/t/query-rollup-causes-performance-issues/83228 "2025-07-16T20:37:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mateo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mateo/32/79814_2.png) [@Mateo](https://community.glideapps.com/u/Mateo)\
**Post date:** [July 16, 2025, 8:37pm UTC](https://community.glideapps.com/t/query-rollup-causes-performance-issues/83228/1 "2025-07-16T20:37:21Z")

</div>

Hi everyone,

I have a situation

I’m working with two large databases (1,000+ rows each), and I need to check if a client has unpaid invoices. The only reliable way to do this seems to be using a **Query column** (filtered by the client name) and then a **Rollup column** to sum unpaid values.

However, when I implement this inside the client rows (so the Query can reference that specific row’s client name), my app starts lagging heavily or even freezes — presumably due to the number of queries running simultaneously.

I understand the suggestion of using a single-row helper table to run one query and avoid the performance issues, but then I lose the ability to see the unpaid amount _per client_. I would end up with something like this (see image), which is not helpful for individualized tracking:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/8/085730ee2ea78a31d0918e2843c8593b32d8fe22.png)

**Is there any workaround that allows for client-specific queries without tanking performance?**  
Or is there a more scalable way to structure this that still gives me visibility into each client’s balance?

Thanks so much in advance for any ideas!

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [July 16, 2025, 9:00pm UTC](https://community.glideapps.com/t/query-rollup-causes-performance-issues/83228/2 "2025-07-16T21:00:49Z")

</div>

So it sounds like you have your query in the Clients table and not the Invoice table, correct?

What does your query filter look like? A relation is usually quicker, but obviously you are restricted to matching one column in each table. However, you could try using a template column in each table to merge multiple values together and then use those template columns to form your relation. It adds additional computed columns, which can be a negative, but still might be better than running a query.

---

<div class="post-metadata">

**Author:** ![Mateo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mateo/32/79814_2.png) [@Mateo](https://community.glideapps.com/u/Mateo)\
**Post date:** [July 16, 2025, 9:59pm UTC](https://community.glideapps.com/t/query-rollup-causes-performance-issues/83228/3 "2025-07-16T21:59:03Z")

</div>

Hmmm okay, so here’s my setup:

I have a table called **Services** , where all my service records live, and a **Clients** table with one row per client.

When I send an invoice, I store the date in a column called `invoice sent date` (in the Services table). Clients have 3 days to pay — after that, the invoice is considered **due**.

To determine this, I use an **if-else column** that checks if today’s date is after the 3-day limit. If it is, the invoice is marked as due.

* * *

✅ What I need:  
➡ For **each row** in the **Clients** table, I want to **sum all due invoices** related to that client.

Using a **Query column** to filter services by client + due status works perfectly — **but** as soon as I apply this for every client row, the performance drops massively.

That’s it — just a per-client total of overdue invoices.  
Still not sure how to do it without killing performance…

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [July 16, 2025, 10:11pm UTC](https://community.glideapps.com/t/query-rollup-causes-performance-issues/83228/4 "2025-07-16T22:11:20Z")

</div>

Ok. Like I mentioned in my previous post, create a template column in the Clients table that concatenates the client ID and whatever value you use for a due status. Make the same template column in the Services table by concatenating the client ID and the result of the IF column. Then create a relation in your Clients table in place of the query. Relations are faster than Queries. Like I said, the downside is the extra template columns but hopefully the overall performance is better than using a Query.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 17, 2025, 12:33am UTC](https://community.glideapps.com/t/query-rollup-causes-performance-issues/83228/5 "2025-07-17T00:33:04Z")

</div>

> [@Jeff\_Hager](#):
>
> Like I said, the downside is the extra template columns but hopefully the overall performance is better than using a Query.

In cases like this, I’m pretty sure relations are always better. Even more so when there’s a date in the process, as dates (even basic columns) take more time to compute.

---

<div class="post-metadata">

**Author:** ![Mateo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mateo/32/79814_2.png) [@Mateo](https://community.glideapps.com/u/Mateo)\
**Post date:** [July 17, 2025, 1:23am UTC](https://community.glideapps.com/t/query-rollup-causes-performance-issues/83228/6 "2025-07-17T01:23:04Z")

</div>

Thank you @Jeff_Hager and @ThinhDinh!

@Jeff_Hager You’re right — I initially thought **relations couldn’t be used for filtering** , but your method using a **tag template** totally works.

What I did:

1. Created a **template column** in both the Clients and Services tables that combines the client ID with the due status (from the `if-else` column).
2. This means only services that are marked as **due** get the correct tag.
3. Then I created a **relation** from the Clients table to Services using that template — and it effectively works as a filtered query, since the tag only applies to due services.

✅ So now the relation gives me **only the due invoices** per client, and I can sum them with a Rollup.

It works perfectly for now! No noticeable performance issues yet — fingers crossed it stays that way.

Thanks again for the help!
