Reducing database size / DB optimization

khpoletik4670

New Member
Jan 19, 2015
11
0
0
Hey guys,

- I think my website DB is growing too fast, any suggestion on keeping DB optimized?
- Is that possible to remove 'session' table rows which are 2,197,619 rows and 8.1 GiB in size?! :shock:
as I know removing unused rows won't decrease the database size... btw, it would be appreciated if anybody help me not to pay for extra disk space every week :(



Thanks.
 

pulseeey

New Member
YetiShare User
Dec 1, 2014
7
0
0
I have the same problem, my sessions table gets to 20GB+.

It generates hundreds of "sessions" seconds after truncating the table, makes no sense.
 

akxx874946

New Member
YetiShare User
Apr 3, 2015
18
0
1
edit file

admin/tasks/auto_prune.cron.php

change to
// delete old sessions
$db->query('DELETE FROM `sessions` WHERE `updated_on` < :updated_on', array('updated_on' => time() - (2 * 24 * 60 * 60)));

and run cron
 

adam

Administrator
Staff member
Dec 5, 2009
2,034
106
63
Hi all,

The session issue is being improved for the next release. We've been working on it the past few days and think we can trim the tables right down. It should be available in a few weeks in the v4.1 code.

For now you can update the cron task as shown above.

Thanks,
Adam.
 

khpoletik4670

New Member
Jan 19, 2015
11
0
0
adam said:
Hi all,

The session issue is being improved for the next release. We've been working on it the past few days and think we can trim the tables right down. It should be available in a few weeks in the v4.1 code.

For now you can update the cron task as shown above.

Thanks,
Adam.
Hi Adam,

Hope our websites to be still alive before releasing the next version, the 'sessions' table grows exponentially again and again even after removing expired rows ... actually nothing can stop it!

1,888 rows ==> 6.1 GiB :cry:


you know yourself that upgrading the script will never fix the issue, we must shrink DB which is not recommended at all or reinstall the web server before installing the next script version, so please find a solution for current costumers (version 4.0.1) :(

would be helpful if we drop 'sessions' table and create it again? :idea:

Code:
DROP TABLE IF EXISTS `sessions`;
CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `data` text COLLATE utf8_unicode_ci NOT NULL,
  `updated_on` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;