jsonb-analytics-snapshot

Store pre-aggregated analytics in a JSONB snapshot for fast dashboard reads.

1|Updated Jan 2, 2025
One-click install
npx skills add https://github.com/allenlin90/eridu-services --skill jsonb-analytics-snapshot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jsonb-analytics-snapshot
Source: https://github.com/allenlin90/eridu-services/tree/main/.agent/skills/jsonb-analytics-snapshot
Command: npx skills add https://github.com/allenlin90/eridu-services --skill jsonb-analytics-snapshot

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Defines the JSONB Analytics Snapshot Pattern for analytics, dashboards, or any feature requiring aggregation of historical/immutable data where high read performance is required.

Core Features & Use Cases

  • Provides a pre-aggregated analytics payload stored as JSONB in a single document to enable fast dashboard reads.
  • Supports time-bounded snapshots (daily/weekly/monthly) with periodStart/periodEnd and periodType to align historical data.
  • Enables a lazy-evaluation workflow: compute when missing and persist the metrics JSON for future requests.

Quick Start

Run a daily snapshot generation for a studio and retrieve the corresponding metrics JSON payload.

Frequently Asked Questions about jsonb-analytics-snapshot

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I speed up dashboard reads for pre-aggregated PostgreSQL analytics data?

Pre-aggregated analytics data can be stored as a JSONB snapshot in a single document to enable fast dashboard reads. This pattern persists the metrics payload, serving it on subsequent requests without recomputing historical aggregations.

What's the best way to generate immutable analytics snapshots for specific time periods?

You can scope data by studio and optional user within defined periods using periodStart, periodEnd, and periodType. This approach aligns historical data into time-bounded snapshots like daily, weekly, or monthly intervals for precise analytics.

How does lazy evaluation work for generating missing JSONB analytics snapshots?

Lazy evaluation for JSONB analytics snapshots computes the metrics payload only when a requested snapshot is missing. After generating the pre-aggregated data, it persists the JSON document to serve all future dashboard requests instantly.

Can I use Prisma to store pre-aggregated JSONB metrics payloads for dashboards?

Yes, Prisma can store pre-aggregated JSONB metrics payloads for dashboards. The JSONB Analytics Snapshot pattern leverages this stack to persist computed analytics documents, ensuring high read performance for immutable historical data.

When do I need a JSONB snapshot pattern for my analytics dashboards?

You need a JSONB snapshot pattern for analytics dashboards requiring aggregation of historical, immutable data where high read performance is critical. It bypasses heavy runtime calculations by serving pre-computed metrics payloads directly.

Are there limitations to using pre-aggregated JSONB snapshots for time-bounded analytics?

Pre-aggregated JSONB snapshots are limited by their immutable, time-bounded nature. Once a snapshot is generated for a specific periodStart and periodEnd, it does not automatically update, making this approach unsuitable for real-time or frequently changing analytics data.