Select count(*) from (select ...) ? See if the query optimizer pipelines that.
Maybe I misunderstand what you are trying to do.
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
Select count(*) from (select ...) ? See if the query optimizer pipelines that.
Maybe I misunderstand what you are trying to do.
The OP wants the paginated table data and the count. With a single query execution.
In normal SQL you'd use a window function to do this but I don't know if mysql supports that.
Would it work to write the query as a common table expression, then select your columns from that table and join it with a count(*)
aggregation of the table?