Right now using the following module makes it easy to query but becomes super difficult when trying to query the database table that has several thousand records including an additional 800k+ records in the data table.
I have a suggestion to query the webform_submission table first and then only grab ids that have values provided in the conditions.
Additionally this will allow for fields on the webform_submission table to also be queried, example use cases are if you'd like to get items within a specific timeframe. Additionally this rewrites the query to use the Sql Select command for non SQL based systems.
I had previously added this https://www.drupal.org/project/webform_query/issues/3064363 but then decided that if a rewrite happens it won't necessarily matter.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | slow_performance-3064366-6.patch | 4.88 KB | imclean |
Comments
Comment #2
sean_e_dietrichComment #3
imclean commentedThanks for the suggestions, the query could certain do with some optimisations. Can you provide any benchmarks?
This is something I had hoped to support at some point. I'll need to review the patch in more detail.
Comment #4
imclean commentedI'm looking into this now, specifically querying the
webform_submissiontable.I chose to use
query()overselect()for performance reasons. See Introduction to Dynamic Queries:Comment #5
imclean commentedThere are a few unrelated changes which make this patch harder to review. Doc block additions and changes to naming conventions mean we're not comparing like for like. I'll need to see if I can extract the bare minimum to including querying the
webform_submissiontable.Comment #6
imclean commentedexecute()method returning the same result type for compatibilityprocessQuery()to return a database statement. This can be used to change the result type. E.g.$query->processQuery()->fetchCol();addCondition()to allow arbitrary tables which have a "sid" column to be queriedwebform_submissionand other arbitrary non-EAV tables first for performanceThe last 3 changes could potentially be handled within the same general tidying up issue.
Example:
Comment #8
imclean commentedCommitted anyway. Try the latest dev.
Comment #9
imclean commentedLet me know if there are any issues.