WhoKnew Views™ | Database Health Check

Skip to main content
Table of Contents
Print

Monitor database footprint, detect data corruption, and maintain optimal storage efficiency for your view counter data

Your view counter data lives in WordPress’s database. WhoKnew Views™ Pro includes comprehensive tools to monitor database health, detect corruption before it causes problems, and maintain optimal performance as your store grows.

🔒 PRO FEATURE — Requires WhoKnew Views™ Pro


🗄️ Understanding the Database Structure

WhoKnew Views™ uses WordPress’s built-in tables—no custom tables that could conflict with other plugins or complicate migrations.

📊 Storage Architecture

📦 wp_postmeta

Per-product data: view timestamps, padding values, custom settings, achievements, aggregates

⚙️ wp_options

Global settings, presets, logs, license status, transient caches, AI learning data

💡 Why This Matters: Using standard WordPress tables means your data is automatically included in site backups, is compatible with migration plugins, and benefits from WordPress’s built-in optimization tools.


🔑 Meta Key Reference

Each product can have multiple meta entries. Here’s a complete reference of what’s stored:

📋 Real View Data (Never Deleted)

product_viewsArray of Unix timestamps (each = one real view)
_wkv_total_real_views_everLifetime counter (never decreases, even when timestamps expire)
_wkv_daily_view_aggregatesCompressed daily summaries for 91-365+ day old data

🎯 Padding & Display Data (Pro)

product_views_base_randomCurrent baseline padding value
product_views_display_countCached total displayed views
product_padded_viewsArray of padded view timestamps with expiration

⚙️ Custom Settings (Pro)

_wkv_use_custom_settings‘true’ if product overrides global settings
_wkv_custom_settingsSerialized array of product-specific config
_wkv_show_counter_frontendVisibility state: ‘1’, ‘0’, ‘preset1’, ‘preset2’, ‘preset3’

🏆 Achievement Data

_wkv_achieved_milestonesArray of earned achievement badge IDs
_wkv_conversion_timesDetailed conversion timestamps (last 90 days)

🔍 Data Integrity Scanning

The Product Data Integrity tool on the System Info page performs deep analysis of your view data:

🔍 What Gets Scanned

📊

Array Structure

🔢

Numeric Values

📅

Timestamp Validity

🔗

Sequential Keys

📈

Aggregation Health

⚠️ Types of Corruption Detected

❌

Non-Numeric Values

Timestamps stored as strings, null, or NaN values that break calculations

⏰

Invalid Timestamps

Values ≤ 0, future dates, or numbers outside Unix timestamp range

🔑

Non-Sequential Keys

Array keys like [0, 1, 5, 8] instead of [0, 1, 2, 3]—causes JSON storage bugs

📊

Aggregation Errors

Daily summary data contains NaN or returns empty when queried


🔧 Automatic Repair Process

When corruption is detected, the Clean Corrupt Data button performs safe repairs:

🔍

Step 1: Scan

Identify all corrupt products

→

🧹

Step 2: Filter

Remove invalid entries only

→

🔢

Step 3: Reindex

Fix sequential array keys

→

✅

Step 4: Verify

Auto-rescan to confirm

ℹ️ Safe Operation: The cleanup only removes clearly invalid data. All valid timestamps are preserved. The Corruption Log records every change for audit purposes.


📊 Database Size Monitoring

The System Info report shows your plugin’s database footprint:

## DATABASE INFORMATION ##
Database Name: wordpress_store
Table Prefix: wp_
Database Charset: utf8mb4
Database Collation: utf8mb4_unicode_ci

Plugin Meta Entries: 2,847(includes view data, settings, achievements)

📈 Growth Estimation

Understanding how data grows helps you plan for scale:

Data TypeSize per EntryGrowth Rate
View Timestamp~10 bytes1 per real view
Daily Aggregate~15 bytes1 per day (after 90 days)
Product Settings~500 bytes1 per product (if custom)
Conversion Record~20 bytes1 per sale

💡 Example: A store with 100 products averaging 50 views/day generates ~1.5 KB of new timestamp data daily. After 90 days, the daily aggregation system compresses old data by ~85%, keeping your database lean.


🗜️ The Aggregation System

WhoKnew Views™ automatically compresses old data to prevent database bloat while preserving historical accuracy:

📋

Days 0-90

Full timestamp precision

product_views

→

📦

Days 91-1825

Daily summaries only

_wkv_daily_view_aggregates

→

🗑️

After 5 Years

Oldest data purged

Rolling window

🕐 Daily Cron Job: The wkv_daily_aggregation_job runs automatically to compress data older than 90 days. This runs for ALL users (Free + Pro) to keep databases healthy.


🚨 Automatic Issue Detection

The System Info’s “Potential Issues Detected” section flags database-related problems:

✖

PHP memory limit is 64M

Recommended minimum is 128M for large catalogs

⚠️

Data exceeds 365 days

Old aggregates may not be deleting properly

ℹ️

Plugin Meta Entries: 15,247

Consider running integrity scan for large datasets


✅ Database Health Best Practices

🔍

Run Monthly Scans

Use “Scan All Products” monthly to catch corruption early

💾

Backup Before Cleanup

Always backup your database before running “Clean Corrupt Data”

⏰

Let Aggregation Run

Don’t disable WP-Cron—the daily aggregation job keeps your database lean

📊

Monitor Growth

Watch “Plugin Meta Entries” count—sudden spikes may indicate issues

🧹

Clear Transient Caches

Use “Clear Forecast Cache” if stale data appears in analytics

Share