Skip to content

ADR‐001: Custom SQL Tables vs Custom Post Types

BODAPATI LAKSHMI KANTH VAMSI edited this page Jan 28, 2026 · 1 revision

Architecture Decision Record 001: Audit Logging Storage

Context

For the Enterprise Audit Logger, we needed a way to store potentially millions of activity logs (user logins, updates, etc.). The default WordPress way is to use "Custom Post Types" (stored in wp_posts), but this scales poorly.

Decision

We decided to implement a Custom Database Table (wp_rt_audit_logs) using the dbDelta() function.

Consequences

  • Performance: Queries are 10x faster because we are not scanning the massive wp_posts table.
  • Scalability: We can index specific columns (like user_id or ip_address) for faster lookups.
  • Data Integrity: Keeps historical log data separate from website content.

Status

Accepted and Implemented.