Skip to Content Skip to Menu

[#5337] comprofiler_views table 640,000 records

  • boyjahq
  • boyjahq
  • OFFLINE
  • Posts: 473
  • Thanks: 33
  • Karma: 3
9 years 1 month ago #272517 by boyjahq
Please tell us how we can disable comprofiler_views. We do not use it and the table size is oppress!ve!

Please Log in or Create an account to join the conversation.

9 years 1 month ago - 9 years 1 month ago #272540 by davidmarshall15
Replied by davidmarshall15 on topic [#5337] comprofiler_views table 640,000 records
If you have access to run perl via cron and want to keep view counts while not having a row for every view, this perl might help.

Note: Use this at your own risk, I do not give any guarantees that it will work.
I run this hourly
Code:
#!/usr/bin/perl -w use DBI; use DBD::mysql; use strict; my $db = 'db_name'; my $conn = ConnectToMySql($db); my $query = ''; ############### # # Compress public views # my $p_id = 0; my $v_date = ''; my $v_count = 0; my @data = ''; my $qry2 = ''; my $qry3 = ''; $query = "select profile_id, max(lastview), sum(viewscount) from PREFIX_comprofiler_views where viewer_id =0 group by profile_id"; my $viewrows = $conn->prepare($query); $viewrows->execute(); while (@data = $viewrows->fetchrow_array()) { $p_id = $data[0]; $v_date = $data[1]; $v_count = $data[2]; $qry2 = "delete from PREFIX_comprofiler_views where profile_id = $p_id and viewer_id =0"; my $delrows = $conn->prepare($qry2); $delrows->execute(); $qry3 = "insert into PREFIX_comprofiler_views (viewer_id, profile_id, lastip, lastview, viewscount) values (0, $p_id, '10.10.10.10', '$v_date', $v_count)"; my $insrow = $conn->prepare($qry3); $insrow->execute(); } ############### # # The End # exit; ############### #--- start sub ConnectToMySql ------------------- sub ConnectToMySql { my ($db) = @_; open(ACCESS_INFO, "</secure_directory/.file_containing_password") || die "Can't access login credentials"; my $host = 'localhost'; my $userid = 'db_user'; my $passwd = <ACCESS_INFO>; my $connectionInfo="dbi:mysql:$db;$host"; close(ACCESS_INFO); chomp ($host, $userid, $passwd); my $l_connection = DBI->connect($connectionInfo,$userid,$passwd); return $l_connection; } #--- end sub ConnectToMySql -------------------
Last edit: 9 years 1 month ago by davidmarshall15.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
9 years 1 month ago - 9 years 1 month ago #272542 by krileon
You could use CB Auto Actions and a Query action then just fire the action URL (found on the Global tab when action is saved) via CRON. It could also use the Internal General trigger if you've multiple actions you want to process with CRON regularly as well.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 9 years 1 month ago by krileon.

Please Log in or Create an account to join the conversation.

  • cberry1971
  • cberry1971
  • OFFLINE
  • Posts: 125
  • Thanks: 7
  • Karma: 0
9 years 1 month ago #272545 by cberry1971
Replied by cberry1971 on topic [#5337] comprofiler_views table 640,000 records
Sorry to be such a noob but you mention earlier in this topic:

you can empty it if you want


in regards to the db.

Can you explain exactly how to do this as I am concerned I might screw something up?

Many thanks.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
9 years 1 month ago #272553 by krileon
Run the below with PREFIX replaced with your actual database table prefix to empty the views table.

Code:
TRUNCATE `PREFIX_comprofiler_views`;

If you're using CB Auto Actions and a Query action the below will be fine.

Code:
TRUNCATE `#__comprofiler_views`;


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • boyjahq
  • boyjahq
  • OFFLINE
  • Posts: 473
  • Thanks: 33
  • Karma: 3
9 years 1 month ago #272571 by boyjahq
Will there ever be a configuration within CB that allows us to disable this? I understand the approaches outlined above, but it is frustrating to burden the server with both collecting unwanted records and then deleting them.
The following user(s) said Thank You: Satchi

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum