Vote to Improve PrestaShop

PrestaShop Forum: Build a free online shop. Count on the Community!

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum: Build a free online shop. Count on the Community!

Jump to content

Photo

Stats & Clean


  • Please log in to reply
11 replies to this topic
Site

    PrestaShop Apprentice

  • Members
  • PipPip
  • 307 posts

Posted 21 April 2010 - 07:16 AM

Hi,
Within stats, there is an option in the settings to "Clean automatically",

Once selected and saved...
What will this clean out? when is cleanup done?
Did we help?, if so give us a like with the green button on the right, it lets others know we can help
----------------------------------------------------------------------------------------------------------------------------------
S1TE.net - www.s1te.net

rocky

    PrestaShop Legend

  • US Moderators
  • 10064 posts

Posted 21 April 2010 - 09:12 AM

I had a look at the code and found that every time a connection is created, all connections in the ps_connections_pages table that were added before the specified interval are deleted. The setNewConnection($cookie) function in classes/Connection.php calls the cleanConnectionsPages() function.
Nethercott Constructions - PrestaShop modules and guides

Site

    PrestaShop Apprentice

  • Members
  • PipPip
  • 307 posts

Posted 21 April 2010 - 12:53 PM

Hi,
So this would clear tables ps_connections or ps_connections_page?
And have no effect on current orders? / Sales stats?


I have around 205,000 enteries in one and 768,000 entries in another. (1 year)
Did we help?, if so give us a like with the green button on the right, it lets others know we can help
----------------------------------------------------------------------------------------------------------------------------------
S1TE.net - www.s1te.net

rocky

    PrestaShop Legend

  • US Moderators
  • 10064 posts

Posted 21 April 2010 - 01:06 PM

It appears to delete from the ps_connections_page only. Here is the query:

// Records of connections details older than the beginning of the  specified interval are deletedDb::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'connections_page`WHERE id_connections IN (    SELECT `id_connections`    FROM `'._DB_PREFIX_.'connections`    WHERE date_add < LAST_DAY(DATE_SUB(NOW(), INTERVAL '.$interval.')))');


The ps_connections_page contains the links between connections and pages only, not the actual connections, which are in ps_connections. I guess that means it won't affect the connections that are displayed on orders.
Nethercott Constructions - PrestaShop modules and guides

Site

    PrestaShop Apprentice

  • Members
  • PipPip
  • 307 posts

Posted 21 April 2010 - 01:57 PM

It seems ps_connections_page looks like it includes data of when a customer has returned back to the website, so we can see when they last logged in etc.

Can you confirm this?


The database is getting very large with both ps_connections & ps_connections_page
Did we help?, if so give us a like with the green button on the right, it lets others know we can help
----------------------------------------------------------------------------------------------------------------------------------
S1TE.net - www.s1te.net

rocky

    PrestaShop Legend

  • US Moderators
  • 10064 posts

Posted 21 April 2010 - 02:02 PM

Yes, the ps_connections_page table contains information about which pages the customer visited at which time. If you aren't interested in this information, you can delete it to save space, since the connection tables can get quite big.
Nethercott Constructions - PrestaShop modules and guides

diana13

    PrestaShop Apprentice

  • Members
  • PipPip
  • 131 posts

Posted 03 May 2010 - 07:08 AM

Can I also empty ps_connections and ps_connections_source without damaged anything else?
I've started a romanian shop with Cosmetice and one with Noni

rocky

    PrestaShop Legend

  • US Moderators
  • 10064 posts

Posted 03 May 2010 - 08:26 AM

I think so. The worst that could happen is that information on when customers last visited your site disappears.
Nethercott Constructions - PrestaShop modules and guides

ukbaz

    PrestaShop Apprentice

  • Members
  • PipPip
  • 177 posts

Posted 24 March 2011 - 01:37 PM

Re ps_connections, ps_connections_page & ps_connections_source Is it possible to edit public static function CleanConectionsPages so that it will dump old data from all 3 tables at once?

I have
public static function cleanConnectionsPages()    {        $period = Configuration::get('PS_STATS_OLD_CONNECT_AUTO_CLEAN');        if ($period === 'week')            $interval = '1 WEEK';        else if ($period === 'month')            $interval = '1 MONTH';        else if ($period === 'year')            $interval = '1 YEAR';        else            return;                    if ($interval != null)        {            // Records of connections details older than the beginning of the  specified interval are deleted            Db::getInstance()->Execute('            DELETE FROM `'._DB_PREFIX_.'connections_page`            WHERE id_connections IN (                SELECT `id_connections`                FROM `'._DB_PREFIX_.'connections`                WHERE date_add < LAST_DAY(DATE_SUB(NOW(), INTERVAL '.$interval.'))            )');        }    }}
In mine have just had to dump lots of old stats data and took ages - even deleting 10,000 rows at a time! Any ideas anyone?

Thanks

Baz

Site

    PrestaShop Apprentice

  • Members
  • PipPip
  • 307 posts

Posted 10 June 2011 - 12:50 PM

Does the new version 1.4.2.5 clean ps_connections and ps_connections_page or ps_guest ?
Did we help?, if so give us a like with the green button on the right, it lets others know we can help
----------------------------------------------------------------------------------------------------------------------------------
S1TE.net - www.s1te.net

rocky

    PrestaShop Legend

  • US Moderators
  • 10064 posts

Posted 10 June 2011 - 01:00 PM

As far as I can tell, the code has remained unchanged in PrestaShop v1.4.2.5, so only ps_connections_page is cleaned.
Nethercott Constructions - PrestaShop modules and guides

babyewok

    PrestaShop Apprentice

  • Members
  • PipPip
  • 448 posts

Posted 15 February 2013 - 02:05 PM

I had a look at the code and found that every time a connection is created, all connections in the ps_connections_pages table that were added before the specified interval are deleted. The setNewConnection($cookie) function in classes/Connection.php calls the cleanConnectionsPages() function.


Hi Rocky - my client has PS 1.3 and having initially set the automaic clean to 'never', after a few years the ps_connections_page table is now huge - it has nearly 3 million rows! I know I can manualy empty this, but I need to know that the automatic clean ins working so I set this to 'yearly' which I assumes would delete all entries older than on year. However three days later and the ps_connections_page table still has just as many rows!

Why woudl these have not been cleaned out by the automatic clean function if this is run every time a connection is made to the site?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users