SOLVED Huge tables causing performance issues

  • OTWD
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
3 years 2 months ago - 3 years 2 months ago #149411 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`);
 

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.

More
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

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc