New paste Use cases Explore public pastes Text tools Developer API The Paste Library Security Sign in with Google
SQLExample pasteCreated 2026-08-012 viewsNo expiry

PostgreSQL index for recent account events

Raw New paste
sqlRead-only
1
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_events_account_created
ON account_events (account_id, created_at DESC)
INCLUDE (event_type)
WHERE deleted_at IS NULL;

EXPLAIN (ANALYZE, BUFFERS)
SELECT event_type, created_at
FROM account_events
WHERE account_id = 42 AND deleted_at IS NULL
ORDER BY created_at DESC
LIMIT 50;
Report abuse

Paste details

Visibility
Public
Size
319 bytes
Protection
Standard link access
Retention
No automatic expiry

Share with confidence

Unlisted links are not searchable, but anyone with the URL can open them. Never paste live credentials or personal data.