database growing and growing please help

Hello all,



Our database is 80mb, and i think its still growing. The stats_banner_log and stat_requests are very big i think because when we make a backup, it takes a long time before it goes to the next one.



When i check in admin the log section we have no banner section there. and the stat request http/https are not turned on.



What can we do to fix this?

Ours was about 50 megs or so and we just ended up clearing logs. What was taking a lot of space was the Statistics. So once a month we would clear them. And just ended up disabling it to help with that and speed up cart. Now we are down to about 30 megs. Also make sure that you are not storing images in the database. This will make it huge.

[quote name=‘CutRiteFX’]Ours was about 50 megs or so and we just ended up clearing logs. What was taking a lot of space was the Statistics. So once a month we would clear them. And just ended up disabling it to help with that and speed up cart. Now we are down to about 30 megs. Also make sure that you are not storing images in the database. This will make it huge.[/QUOTE]



Hey just out of interest, what is the memory limit that you have set in your config.local file?



Thanks

[quote name=‘badmaash’]Hey just out of interest, what is the memory limit that you have set in your config.local file?



Thanks[/QUOTE]



Ours is the default

// Set maximum memory limit

@ini_set(‘memory_limit’, ‘48M’);



We have never played with this. Not sure how it would change the store.

[QUOTE]Ours is the default

// Set maximum memory limit

@ini_set(‘memory_limit’, ‘48M’);



We have never played with this. Not sure how it would change the store.[/QUOTE]



Depending upon your available hosting resources, this setting can make a substantial difference (& only takes a minute to change it)!

I posted a thread about my db growing out of control… I can’t figure out where it is coming from. I have stats disabled and I delete the admin log periodically. I inquired about other routine maintenance to keep the db in check, but no one had any ideas. My db is up to 94 MB now. It was as low as 20 MB when I upgraded to 2.0.12 at the beginning of Feb.

[quote name=‘ogia’]I posted a thread about my db growing out of control… I can’t figure out where it is coming from. I have stats disabled and I delete the admin log periodically. I inquired about other routine maintenance to keep the db in check, but no one had any ideas. My db is up to 94 MB now. It was as low as 20 MB when I upgraded to 2.0.12 at the beginning of Feb.[/QUOTE]



You can see which table is growing which should give you an indication of what is causing it. Could be sessions, logs, stats.

I didn’t think of trying to see the size of each individual table… I thought I had to click into each one so that’s why I wasn’t finding it. :rolleyes:



My stat_sessions table was the one that was fine… it’s stored_sessions that is overgrown.



I need the :doh: emoticon. :wink:



Okay, so I noticed most sessions are expired according to the expiry date in the table… are they supposed to be deleted by cs-cart and aren’t being deleted or is this something I have to do manually?

[quote name=‘ogia’]Okay, so I noticed most sessions are expired according to the expiry date in the table… are they supposed to be deleted by cs-cart and aren’t being deleted or is this something I have to do manually?[/QUOTE]

The old sessions are supposed to be deleted automatically:

[url]http://forum.cs-cart.com/vbugs.php?do=view&vbug_id=1657[/url]



Looks like a new bug report is needed.



Bob

[quote name=‘jobosales’]The old sessions are supposed to be deleted automatically:

[url]http://forum.cs-cart.com/vbugs.php?do=view&vbug_id=1657[/url]



Looks like a new bug report is needed.



Bob[/QUOTE]

Hmm… can anyone else confirm it’s not just me?



My stored_sessions table has 60,000 rows and is 59 MB. What exactly is the purpose of this data?

[quote name=‘ogia’]Hmm… can anyone else confirm it’s not just me?



My stored_sessions table has 60,000 rows and is 59 MB. What exactly is the purpose of this data?[/QUOTE]

The table contains the “environment” settings for each user: currency, language, user groups and the like. A lot of them are probably visits from bots.



Bob

[quote name=‘ogia’]Hmm… can anyone else confirm it’s not just me?



My stored_sessions table has 60,000 rows and is 59 MB. What exactly is the purpose of this data?[/QUOTE]

These are definitely supposed to be deleted once they have expired. Here is the code from /core/class.session.php which is supposed to delete the old entries:

// Cleanup sessions storage
db_query('DELETE FROM ?:stored_sessions WHERE expiry < ?i', TIME - SESSIONS_STORAGE_ALIVE_TIME);

return true;




SESSIONS_STORAGE_ALIVE_TIME is set to 2 weeks in the standard config.php



At a minimum, it should be safe to delete all entries older than a month and then optimize the table.



Of course, back up the table before doing anything.



Bob

Okay - I think I have confirmed that in 2 weeks, my store apparently generates ~60 MB worth of stored_sessions data. I went back to March 13 and there are no records with an expiry prior to then.



When the record is created, the ‘expiry’ field is actually filled with the current unix timestamp so that’s why all the records I checked seemed to be expired.

Check the data field to see if you have a bunch of records for bots. You could easily delete those with no problem.



Bob

Hi,

Not sure if any of you have ScanAlert or something similar, but a couple of years ago, I had a problem with another cart I have. The bandwidth all of a sudden, was being used up quickly and the sessions table had to be cleared more often.

The host at that time determined that the problem was:

[QUOTE]In looking at it you have 19 IP addresses that are downloading a ton of data from your site. They all appear to be owned by a company called Savvis. Those individual computers have downloaded anywhere from 250meg to 1.1gig. That would explain nearly all of your overage.

[/QUOTE]

I traced this to ScanAlert and then had to stop the service.

May want to look into this if you are using a scan service, especially if it is a daily scan.

Bob