- Posts: 330
- Thank you received: 5
SOLVED Huge tables causing performance issues
- OTWD
-
Topic Author
- Offline
- Platinum Member
-
Less
More
3 years 2 months ago - 3 years 2 months ago #149411
by OTWD
Success consists of going from failure to failure without loss of enthusiasm.
SOLVED Huge tables causing performance issues was created by OTWD
Can you explain the relationship between #_eb_field_values , #_eb_events and #_eb_registrants?
So if i delete all events and registrants before 2017 how can i then delete the field values related to those specific events and registrants?
#_eb_field_values is 24mb and only has:
id
registrant_id
field_id
field_value
I cant seem to find a relationship?
#_eb_field_values
registrant_id is FK to
#_eb_registrants
id
Here is the Delete statements to remove records prior to 2018
Step 1:
D ELETE F ROM `#_eb_events` W HERE `event_date` < "2018-12-31 00:00:00";
Step2:
D ELETE F ROM `#_eb_registrants` W HERE `event_id` NOT IN ( S ELECT `id` F ROM `#_eb_events`)
Step3:
D ELETE F ROM `#_eb_field_values` W HERE `registrant_id` NOT IN ( S ELECT `id` F ROM `#_eb_registrants`);
So if i delete all events and registrants before 2017 how can i then delete the field values related to those specific events and registrants?
#_eb_field_values is 24mb and only has:
id
registrant_id
field_id
field_value
#_eb_field_values
registrant_id is FK to
#_eb_registrants
id
Here is the Delete statements to remove records prior to 2018
Step 1:
D ELETE F ROM `#_eb_events` W HERE `event_date` < "2018-12-31 00:00:00";
Step2:
D ELETE F ROM `#_eb_registrants` W HERE `event_id` NOT IN ( S ELECT `id` F ROM `#_eb_events`)
Step3:
D ELETE F ROM `#_eb_field_values` W HERE `registrant_id` NOT IN ( S ELECT `id` F ROM `#_eb_registrants`);
Success consists of going from failure to failure without loss of enthusiasm.
Last edit: 3 years 2 months ago by OTWD. Reason: worked it out myself
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
3 years 2 months ago #149443
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic SOLVED Huge tables causing performance issues
Yes. That's right solution. Thanks for sharing the solution back to us
Regards,
Tuan
Regards,
Tuan
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.