Menu

#2672 Cleaning up database to remove old bookings

open
nobody
None
7
2023-01-09
2023-01-02
Anonymous
No

Hello brilliant folks,

First off, I wish you a very Happy New Year and lall the best to MRBS!

Second, please forgive me if this is a trivial question but I guess I never paid attention to this issue since I first started with MRBS 1.4.x

Third, this is not a bug but just a question from an old timer having his brain washed out to start the new year.

I just happened to realize that our current MRBS database size is increasing a lot and I just can't figure if there's any tool/config param or else to tackle this basic question....

I just looked at the tables and figured that I could probably do some sql delete on both mrbs_repeat and mrbs_entry based on year(timestamp) for instance but before I start hacking something which already exists somewhere, I thought I'd better first ask :-)

Thanks to let me know.

Best regards from Paris,

Philippe

Discussion

  • Campbell Morrison

    The easiest thing to do is to do it through MRBS itself. Make sure you have $auth['show_bulk_delete'] = true; set in your config file, then login to MRBS as an admin and go to the Report page. Then run a report selecting all those entries you want to delete, eg all for a particular year. You should then see a button "Delete entries" at the bottom of the page. Be careful though, it can't be undone, so you might want to take a backup first.

    The other thing to look out for is the sessions table which will grow very large if your PHP gc probability is set to zero.

     

    Last edit: Campbell Morrison 2023-01-03
  • Anonymous

    Anonymous - 2023-01-06

    Hello Campbell,

    Thx for the info. Wasn't aware of this parameter
    Just one comment about this: Having about 45000 entries to delete, I think that it would maybe nice to see a wait cursor or a message line indicating that the operation is ongoing and maybe disable the Delete button while the process is running...

    Cheers,

    Philippe

     
    • Campbell Morrison

      I think that it would maybe nice to see a wait cursor or a message line indicating that the operation is ongoing and maybe disable the Delete button while the process is running...

      Good idea. I've now added a progress bar and a Cancel button in 9c4c4d.

       
  • Anonymous

    Anonymous - 2023-01-06

    And speaking of the sessions table which is - you're right - quite important, is there a simple way to decode the access field or else in order to filter out what has to be deleted?
    Thx

     
    • Campbell Morrison

      I've now added a comment in 53538b5.

       
  • Campbell Morrison

    I'd recommend though letting PHP's garbage collector do the work if you can rather than deleting rows manually. As long as the gc probability is non-zero, the rows will eventually be deleted automatically.