How to debug a Paged Record Query?

I am trying to resolve an issue and I want to check the SQL output but only just realised that we don’t have the debug option for Paged Record queries.

Is there a reason for the option to be missing?
Is there another way to debug Paged Record queries?

Paged Record query…

image

Multiple Records query…

image

Single Record query…

image

If you’re developing locally and using MySQL, I would very much recommend setting things up so you have access to the query log. This will show you exactly what queries are run, as they’re executed - not showing variables etc.

This has cropped up in a few threads, eg this one which suggested using Wappler’s terminal. I actually prefer to display the log in a text editor most of the time, set so the output is automatically updated.

Thanks Tom, I always forget about the log files.

Just ran one Server Action using an empty log file. Always takes ages. Now I see why. 2Mb log created with 5000 lines. Think I need to rework this!

It’s an address file but picks up phone numbers, contacts, addresses, notes etc all from separate DB tables.

Wish I hadn’t asked now :smile:

I’ve never noticed any delay when log files are created, though you wouldn’t want to have them enabled on a live site.

It seems strange that 5000 lines should be created for a paged query. I have some quite complicated queries producing a single line in the query log of over 3000 characters, but this, along with the returned records, appears instantly. Perhaps this indicates a problem with your query.

It’s nested queries, so, say 500 companies from one query, then each company having average of 5 contacts fetched by a query, then each contact could have say, 5 ways of contacting (ie landline, mobile, email, facebook etc) which is another query. So that’s about 2500 query calls and about 12500 results (roughly). And it’s actually more complicated than that.

Better to just have 1 query call :smile:

Couldn’t you reduce the number of companies to one or two - just for the purpose of debugging the query?