• Resolved Artan

    (@artankrasniqi1988)


    Hi,

    how to delete all collected data for example between 04.05.26 – 20.05.26 (dd.mm.jj)?

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mostafa Soufi

    (@mostafas1990)

    Hi Artan,

    There is no built-in option for deleting a specific date range. The Optimization purge tool only removes data older than a set number of days (minimum 30), and Purge Visitors filters by view count, IP, browser, or platform, not by date.

    For an exact range you will need direct SQL, which you are clearly comfortable with. Please back up the tables first, then for 2026-05-04 through 2026-05-20 inclusive (adjust the dates and the table prefix as needed):

    DELETE FROM wp_9bt6r02gw6_statistics_visitor_relationships
      WHERE date >= '2026-05-04 00:00:00' AND date < '2026-05-21 00:00:00';
    
    DELETE FROM wp_9bt6r02gw6_statistics_visitor
      WHERE last_counter BETWEEN '2026-05-04' AND '2026-05-20';
    
    DELETE FROM wp_9bt6r02gw6_statistics_pages
      WHERE date BETWEEN '2026-05-04' AND '2026-05-20';
    
    DELETE FROM wp_9bt6r02gw6_statistics_events
      WHERE date >= '2026-05-04 00:00:00' AND date < '2026-05-21 00:00:00';
    
    DELETE FROM wp_9bt6r02gw6_statistics_exclusions
      WHERE date BETWEEN '2026-05-04' AND '2026-05-20';
    
    DELETE FROM wp_9bt6r02gw6_statistics_summary_totals
      WHERE date BETWEEN '2026-05-04' AND '2026-05-20';
    

    The historical table holds carried-over totals with no date column, so leave it untouched. After running the deletes, clear the report cache so the dashboard refreshes:

    DELETE FROM wp_9bt6r02gw6_options
    WHERE option_name LIKE '%wp_statistics_cache%';
    

    One caveat: visitor rows are bucketed by their last-seen date (last_counter), so the visitor delete is approximate at the edges of the range. The summary_totals and visitor_relationships tables are date-accurate, and summary_totals is what the Overview totals read from.

    If a persistent object cache (Redis or Memcached) is in play, flush it too. Let me know if anything looks off afterward.

    Thread Starter Artan

    (@artankrasniqi1988)

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.