My work
From my work Search change rolled back

Looking beyond a slow search panel

When a search panel started failing under load, we traced the problem to two large queries with many subqueries, one for search and another for data export. Improving the SQL was our first step, but the investigation also led us to review how the panel handled both operations.

What I worked on

I investigated the issue by checking execution times and tracing how the panel used each query, then helped improve the search query and optimised the export query myself.

What changed our approach

We initially focused on making the queries faster. Reviewing the panel with Tech Leads and SQL specialists made me question whether large exports needed to run through the panel at all. They used the same filters as search but returned more fields, through a different query.

We proposed moving those exports into a separate batch process that generates the file and sends it to the user. Later, when the search change caused problems in production, we learned that another team was already building a replacement for the panel. We rolled back my search implementation.

Where it stands

Export · In production

The first export optimisation remains in production. In production checks, it extracted 350 records in under a minute, compared with 160 in more than a minute before the change. Larger exports still hit the timeout. This was a separate change and was not part of the search rollback.

Search · Rolled back

Initial tests in non-production environments returned the same data in about 4 seconds rather than more than 60 seconds. Those tests did not reproduce production conditions. After deployment, my implementation overloaded the database and affected contract processing. We rolled it back to restore normal operation.

Read: I broke production trying to fix it