# pgFirstAid > Easy-to-deploy, open source PostgreSQL health-check SQL function. ## Docs - [Home page](https://pgfirstaid.com/): single-page overview of what pgFirstAid is, install, features, compatibility, news, sponsors - [GitHub repository](https://github.com/randoneering/pgFirstAid): source code, releases, issues, contributing ## Usage - Primary: call the function directly: `SELECT * FROM pg_firstAid();` - Optional view: `SELECT * FROM v_pgfirstAid;` (same rows as the function) ```sql -- Copy and paste the function or view definition into your PostgreSQL database -- Then run it: --- function SELECT * FROM pg_firstAid(); --- view SELECT * FROM v_pgfirstAid; Filter by Severity -- Show only critical issues SELECT * FROM pg_firstAid() WHERE severity = 'CRITICAL'; SELECT * FROM v_pgfirstAid WHERE severity = 'MEDIUM'; -- Show critical and high priority issues SELECT * FROM pg_firstAid() WHERE severity IN ('CRITICAL', 'HIGH'); SELECT * FROM v_pgfirstAid WHERE severity IN ('CRITICAL', 'HIGH'); Filter by Category -- Categories: Table Health, Query Health, Replication Health, System Health, Database Health -- Check table health SELECT * FROM v_pgfirstAid WHERE category = 'Table Health'; Count Issues by Severity SELECT severity, COUNT(*) as issue_count FROM pg_firstAid() GROUP BY severity ORDER BY MIN(CASE severity WHEN 'CRITICAL' THEN 1 WHEN 'HIGH' THEN 2 WHEN 'MEDIUM' THEN 3 WHEN 'LOW' THEN 4 ELSE 5 END); ``` ## Optional - [Full content (markdown)](https://pgfirstaid.com/llms-full.txt): the entire site content as one markdown document - [agents.txt](https://pgfirstaid.com/agents.txt): capability declaration for AI agents