View Issue Details

IDProjectCategoryView StatusLast Update
0004941Composrcore_database_driverspublic2022-09-27 17:22
ReporterChris GrahamAssigned To 
SeverityFeature-request 
Status non-assignedResolutionopen 
Product Version 
Fixed in Version 
Summary0004941: Database cursor support
DescriptionWe do not currently have any support for database cursors. A query will return as many results as we ask for in one go, and then we're done with it.

Consider this query we were considering doing...

SELECT recipient_id,SUM(amount_points)+SUM(gift_points)-(SELECT SUM(amount_points)+SUM(gift_points) FROM cms11_points_ledger refund WHERE refund.status='refund' AND refund.date_and_time>=START AND refund.date_and_time<END AND refund.recipient_id=normal.recipient_id) AS points FROM cms11_points_ledger normal WHERE normal.status='normal' AND normal.date_and_time>=START AND normal.date_and_time<END GROUP BY recipient_id ORDER BY points DESC LIMIT 10;

This is finding the top members by points within a date range. However, if we were to filter some of the results out in PHP, we'd want to not have a LIMIT clause, and we'd not want to paginate the results (very slow when aggregate functions are involved) - we'd want to just keep cursoring through.

I'm somewhat ambivalent on this change. It's taken until now to find a use case, and the solution to our use case is just to turn off the PHP memory limit as we are running in a Cron hook anyway (and if we're concerned about memory, the cursoring query would still use lots too, just in MySQL rather than in PHP).
TagsNo tags attached.
Time estimation (hours)24
Sponsorship open

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2022-09-17 00:05 Chris Graham New Issue
2022-09-17 00:05 Chris Graham Tag Attached: 24
2022-09-27 17:22 Chris Graham Time estimation (hours) => 24
2022-09-27 17:22 Chris Graham Tag Detached: 24