Vanilla open source was terminated 1 January 2025 by Higher Logic. See this announcement for more information.
My GDN_Session table is over 80MB. Can I empty it

I think it will improve some performance
There was an error rendering this rich post.
0
I think it will improve some performance
There was an error rendering this rich post.
Comments
Yep, I think you can. You have backups, right?
There was an error rendering this rich post.
yeah
There was an error rendering this rich post.
@aery i have created a cron job for that, deleting every 3 days to make self-hosted site lighter
Share! Share! :-) on the Wiki or here :-)
There was an error rendering this rich post.
if you delete sessions, more elegant to delete older than some time.
grep is your friend.
Sorry, I'm not sure I understood this correctly. Could you please clarify? Thanks.
My shop | About Me
don't delete all the session just older ones, also known as pruning
grep is your friend.
Ah, now I got it. That's what I do already, which is the reason why I didn't get it straight away (I consider it the "default" way of deleting old stuff). Thanks for the clarification.
My shop | About Me
@UnderDog i'll share but somehow this is just a silly program i made for cron..
the code is below, you can add it to your CPANEL cronjob mine i have set it up every 1 hour.
I wish someone could create a plugin for this it would be helpful
<?php $hostname_cnCleaner = "localhost"; $database_cnCleaner = "YOUR_DATABASE_NAME"; $username_cnCleaner = "YOUR_DATBASE_USERNAME"; $password_cnCleaner = "YOUR_DATBASE_PASSWORD"; $cnCleaner = mysql_pconnect($hostname_cnCleaner, $username_cnCleaner, $password_cnCleaner) or trigger_error(mysql_error(),E_USER_ERROR); date_default_timezone_set('Asia/Manila'); ?>
<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_cnCleaner, $cnCleaner); $query_rsClean = "DELETE FROM `YOUR_DATABASE_NAME`.`GDN_Activity` WHERE `YOUR_DATABASE_NAME`.`GDN_Activity`.`DateInserted` < (NOW() - INTERVAL 2440 MINUTE)"; $rsClean = mysql_query($query_rsClean, $cnCleaner) or die(mysql_error()); echo "ACTIVITY: ".date('h:i:s') . " DELETED: ".mysql_affected_rows(); ?>
you can setup the INTERVAL 2440 MINUTE to any time that you want the history to be deleted from to current date.
Creating a plugin should be quite easy. My Cron plugin was created exactly for this kind of things. All you would have to do would be creating a fairly simple plugin, which does just two things:
mysql_*
functions are deprecated and that PDO should be used instead).My shop | About Me
@businessdad thanks for your that advice, i'll take that seriously. .. somehow right now i'm still focusing on themes and templates. I really would like to dig deeper in to coding and making plugins
this is just a dirty workaround i made coz of frustration of server overloads xD
Hi alle,
I'd like to hang in here another table that could be cleaned from time to time i think. GDN_Draft can also grow a little, even though some people left the forum or just don't manage old drafts anymore.
Does anyone know if this table ha a correlation to another table? If not, and drafts are just driven through this table you could possibly clean those drafts that were last updated in 2010 or 2011 for example.
Greetz, i just went again through my board which recently rund a 100MB database, cleaning a little brought me down to 75MB.
Backup, backup, backup before!
@phreak Maybe this plugin will work
http://vanillaforums.org/addon/cleanlog-plugin
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌