Skip to content

Background/Async Query Execution with File Storage #168

@PM84

Description

@PM84

Problem Statement

In large-scale Moodle installations with extensive databases, many custom SQL queries take a very long time to execute, often exceeding PHP execution time limits and causing timeouts.

Current limitations:

  • Long-running queries fail due to timeout constraints when executed synchronously
  • The existing customdir workaround requires direct filesystem access
  • In managed hosting environments where filesystem access is restricted to operations teams, this creates:
    • Unnecessary operational overhead
    • Delays in accessing query results
    • Additional coordination between teams

Proposed Solution

Implement background/asynchronous query execution with integrated file storage, allowing:

  • Queueing long-running queries for background execution via adhoc tasks
  • Storing results in Moodle's file storage (file API) instead of requiring direct filesystem access
  • User notifications when query execution completes or fails
  • Execution history and management through a dedicated interface

Use Case

Scenario: A instance has e.g. more than 500,000+ students and needs to run complex enrollment reports that take 5-15 minutes to execute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions