ci_sessions table is getting big - like 6M records and 90meg big |
ci_sessions table is getting big - like 6M records and 90meg big
Is there any problem with me just truncating the table? These are my settings in config PHP Code: $config['sess_driver'] = 'database'; I also note that my table did not have the primary key set: PHP Code: // When sess_match_ip = FALSE So my plan is to truncate the table (knock it to 0 records) and then add the primary key. Buuuuut - this is a production DB so I want to get the advice of the learned folks here before I commit such an act. Also why would my sessions in ci_sessions not be being cleaned up by the garbage collector?
Maybe a cron like this would help:
PHP Code: /**
These are the defaults for php.ini
Code: session.gc_probability = 1 Try that. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-02-2018, 08:12 PM)zurtri Wrote: hmmm. both those values are 0 in my php.ini Yup. That is a problem. InsiteFX offers a typical setting with session.gc_divisor = 1000 being the recommended "Production Value:. You could make it happen more often with Code: session.gc_probability = 1 The ratio of session.gc_probability to session.gc_divisor determines the chance that GC will occur not a hard and fast "once every 500 times". You might find this article interesting. The article suggests one reason why the values would be set to zero - so a cron job could periodically clean up. Looks like you don't' have that cron setup. |
Welcome Guest, Not a member yet? Register Sign In |