Developed by NWLYNX
DOWNLOADS

Online Demo Download the source
 

11/23/11
PostgreStats 1.2
is Now Available!
Download it Here.
PostgreStats V1.2 includes various fixes such as replacing depreciated PHP functions and further initialization of indexes, variables and offsets. V1.2 has also been tested under RHEL 6.1, PostgreSQL 8.4.9 and PHP 5.3.3. Enjoy!

11/23/11
Thank you!
A huge thanks to developers all over the world who have submitted critical feedback and critcism regarding the PostgreStats software package. I'm very glad you guys are finding it as useful as I have!

9/30/10
Postgrestats is
Now Open Source!
I couldn't be more excited to announce that the PostgreStats package is now open source software and licensed under the GNU GPL License. As my first major contribution to the OS community and after three years in fanatical development, I'm stoked and very hopeful PostgreSQL developers & admins will find this package as useful as I have.

9/27/10
Expanded Statistics!
Thank you to devs & Postgres admins for feedback. PostgreStats is now statting several new database fields including Sequences & Indexes as well as rows used in both Sequence and Index Scans. Check out the online demo to see it in action right here.

Feedback:
If you'd like to provide feedback or comments on PostgreStats, please email us. We'd love to hear your thoughts on our software whether that's criticism or ideas you'd like to see implemented in a future release.

Extract, store and display statistics from PostgreSQL's Stat Collector in an automated, graphical fashion.

What is PostgreStats?
PostgreStats is a powerful set of fully automated scripts allowing you to easily extract, store, monitor and display online statistics from PostgreSQL's Stat Collector. Built on a fully documented and tested PHP/AJAX model, it uses a custom, compact log file format to minimize database impact and keep performance levels up.

With various reporting views, optional Apache security, email snapshot reports and auto vacuum / analyze on update, PostgreStats allows you to view and track your Postgres activity in a whole new light.





Okay, why?
If you're familiar with the PostgreSQL Statistics Collector process, you already know it contains valuable stat data on your running databases but you also know that the views which contain this data such as pg_stat_database and pg_stat_user_tables, are simply running numbers of commits, inserts, buffer hits, etc. Stats are not broken down by days or months and not put into any meaningful format which easily allows you to make the most out of it. PostgreStats was designed precisely with this in mind, to support the viewing of primary statistics broken down by database in timed cycles in a multitude of views, helping you identify trends, issues and general knowledge of your Postgres implementation.


How Does it Work?
If you're here, you're a database geek like us (no worries, we'll make it). In a nut-shell, here's how PostgreStats works under-the-hood.


Install and Configure:
The PostgreStats install directory contains a configuration file which you'll use to customize your implementation. It's here you'll set up where your install directory resides, credentials such as the PostgreSQL super-user responsible for resetting statistics (VIA pg_stat_reset on each log-update), interface options and other optional features such as email report updates, optional Apache security, whether you'd like to auto-vacuum analyze databases on log update, etc.
Log Data, Execution and Automation:
PostgreStats uses a txt file, log data format VS a PostgreSQL data source itself to house stats and minimize impact on the Postgres service while obtaining statistics. A single PHP script file is then set up as a root cron-service, updating at whatever interval you desire but at least once a day. On each log-update, PostgreStats queries the stat collector (only a single set of database credentials is required), gathers data from the pg_stat_database and pg_stat_user_tables views, and then formats all data, resulting in either a new log-file or an updated log-file. The pg_stat_reset function is then called, resetting the counter statistics in its respective views and the cycle repeats.
Viewing Stats:
PostgreStats are viewed online in a single, highly dynamic web page built in PHP / AJAX. Your installation directory is where all of the data and scripts are housed. You can then set-up a site VIA Apache or install PostgreStats in an existing site or further customize automation, EG: your database server is not equipped with Apache and you need to automate the process of moving data files from one server to another.
Security:
For maximum security, PostgreStats is not designed to be executed VIA CGI or online rather command line / cron only VIA root. PostgreStats has an optional, turn-on/offable feature which allows you to set up standard, in-the-clear Apache realm user / pass authentication credentials. This will require a log-in to view statistics online. For added security, it is recommended you restrict access to the HTTPS protocol.


From the Developer:
My name is Joel Detter, PHP / PostgreSQL programmer and lead developer of PostgreStats. I started developing PostgreStats for my own company's (NWLYNX) use when Postgres was at version 7.4. I went years without knowing exactly what was going on behind the scenes of my Postgres implementation and viewing website statistics is not a valid indication of database activity, as you know. I was introduced to several great Linux/Unix based shell techniques and quickly learned to monitor PostgreSQL activity which gave me some insight as to performance, but I wanted to see more stats and on new levels.

The first time I turned on the Stat Collector Process in PostgreSQL, I was astonished to see such detailed statistics available but to me, unless I could break down this data further, tallying numbers in the stat views was not quite meaningless. I wanted to view online all of the databases in my implementation, individual and detailed stats for each one with options for breaking down data in time intervals, comparing data from previous days, months, side-by-side, etc.

When I saw for the first time what PostgreStats revealed about my databases, I was quite literally shocked. Since then, I've used this data to help me understand PostgreSQL performance on my network and have re-written queries and complete systems because of that. From my years of research, I knew many other PostgreSQL users and developers would also love to see statistics in this format, as a great supplemental tool for monitoring performance of Postgres Databases and viewing stat collector statistics.
Features:
Graphical Statistics

• Monthly Snapshot Review
• Daily Over-all Statistics
• Individual Database Statistics
• Month VS Month Statistics Analysis
• Weekly Trending Stats
• Yearly Summary Statistics

Meaningful Data
• Peak Day Statistics
• Data Comparison on Previous Cycles
• Trending & Activity Statistics
• Averages: Day / Hour / Min / Sec
• Stats all Major Statistics Including:
  - Commits
  - Rollbacks
  - Block Reads
  - Buffer Hits
  - User Inserts
  - User Updates
  - User Deletes
  - Sequence Scans & Rows Used in Scans
  - Index Scans & Rows Used in Scans

Easy to Set-up / Fully Automated
• Simple Customizable Conf File
• Automated Easily with Cron
• Log File Data Storage for Portability
• Fully Tested under Postgres V7.4 / V8.4

Powerful Options and Features
• Optional Email Snapshot Reports
• Optional CSS Customization
• Optional Standard Apache Security
• Optional Local Log Back-up
• Optional Vacuum Analyze on Update