What is Joomla session table and why do we need it?
As the name implies, jos_session table stores temporary data of Joomla users and it is used to manage user sessions. A loaded session table can have a serious impact on your Joomla site and often cause slow down. Joomla updates the session table on every page view and it is, in fact, the most active table (write-wise) on a Joomla website
Common reasons for this issue:
The most common cause of a corrupt table is a failed write. Joomla is not very good at handling sessions efficiently. So, the same user can have multiple session entries in the database.
- When the server runs out of resources [OR]
- If the Joomla website is managed on an underpowered server’s or VPS and they occasionally crash under high load. There is a possibility that Joomla session table “jos_session” table becomes corrupt and shows this error while browsing websites:
++++=============== jtablesession::Store Failed DB function failed with error number 1146 Table 'dbname.jos_session' doesn't exist SQL=INSERT INTO `jos_session`( `session_id`,`time`,`username`,`gid`,`guest`,`client_id` ) VALUES ( 'rAxRWo70lP8aQOwtokou4IRsMZ','2444128272','','0','1','0' ) ===============++++
By default, these corrupted tables can’t be repaired with MySQL check. And how could one resolve this?
Here is the simple fix to resolve this issue:
– Need to backup whole database using mysqldump
– Get in to DB access via phpMyAdmin/Command line
– Drop the corrupted table “jos_session table”
– Create the new table named as “jos_session table” and the paste the below query:
+++=============== CREATE TABLE IF NOT EXISTS `jwq7m_session` ( `username` varchar(150) default '', `time` varchar(14) default '', `session_id` varchar(200) NOT NULL default '0', `guest` tinyint(4) default '1', `userid` int(11) default '0', `usertype` varchar(50) default '', `gid` tinyint(3) unsigned NOT NULL default '0', `client_id` tinyint(3) unsigned NOT NULL default '0', `data` longtext, PRIMARY KEY (`session_id`(64)), KEY `whosonline` (`guest`,`usertype`), KEY `userid` (`userid`), KEY `time` (`time`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ===============+++
The above query will recreate the table structure and allow Joomla users to write their session files.
Also, sometimes there are chances that you get a crash notification like the error below:
++++=============== Table 'dbname.jos_session' is marked as crashed and should be repaired SQL=INSERT INTO `jos_session` (`session_id`,`time`,`client_id` ) VALUES ( 'rAxRWo70lP8aQOwtokou4IRsMZ','2444128272','0' ) ===============++++
In such cases, you might need to repair the table to solve the issue. You may follow the instructions given here, just in case you need any help.
Alternatively, some say that a lower session lifetime in the configuration settings could be the cause. In that case, you should be updating the configuration and this post can be of a good help.
If you feel this is tricky and you can’t take any risk, our database experts can assist you in getting this fixed at a pocket-friendly price. All you need to do is to contact us and we’ll take care of the rest.