PHPackages                             trogers1884/laravel-mvstats - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. trogers1884/laravel-mvstats

ActiveLibrary[Database &amp; ORM](/categories/database)

trogers1884/laravel-mvstats
===========================

Laravel package for PostgreSQL statistics

v1.0.1(1y ago)04MITPHPPHP ^8.1|^8.2|^8.3

Since Dec 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/trogers1884/laravel-mvstats)[ Packagist](https://packagist.org/packages/trogers1884/laravel-mvstats)[ RSS](/packages/trogers1884-laravel-mvstats/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

Laravel PostgreSQL Materialized View Statistics
===============================================

[](#laravel-postgresql-materialized-view-statistics)

A Laravel package that automatically tracks and manages statistics for PostgreSQL materialized views.

Features
--------

[](#features)

- Automatically tracks creation, modification, and refresh operations on materialized views
- Records refresh durations, counts, and timestamps
- Provides statistics through an easy-to-query view
- Includes Artisan commands for statistics management
- Supports PostgreSQL 12 or later
- Compatible with Laravel 10+
- Requires PHP 8.1+

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require trogers1884/laravel-mvstats
```

The package will automatically register its service provider.

### Requirements

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.0 or higher
- PostgreSQL 12.0 or higher

### Database Objects Created

[](#database-objects-created)

This package creates the following database objects:

1. Tables:

    - `public.tr1884_mvstats_tbl_matv_stats` - Base statistics table
2. Views:

    - `public.tr1884_mvstats_vw_matv_stats` - Formatted view of statistics
3. Functions:

    - `public.tr1884_mvstats_fn_mv_activity_init()` - Initializes tracking for existing materialized views
    - `public.tr1884_mvstats_fn_mv_activity_reset_stats()` - Resets statistics
    - Several internal trigger functions
4. Event Triggers:

    - Triggers for tracking materialized view operations

Usage
-----

[](#usage)

### Viewing Statistics

[](#viewing-statistics)

Once installed, the package automatically tracks all materialized view operations. You can query the statistics view:

```
SELECT * FROM public.tr1884_mvstats_vw_matv_stats;
```

The view provides the following columns:

- `mv_name` - Name of the materialized view (schema.name format)
- `create_mv` - Creation timestamp
- `mod_mv` - Last modification timestamp
- `refresh_mv_last` - Last refresh timestamp
- `refresh_count` - Number of refreshes
- `refresh_mv_time_last` - Duration of last refresh
- `refresh_mv_time_total` - Total refresh time
- `refresh_mv_time_min` - Minimum refresh duration
- `refresh_mv_time_max` - Maximum refresh duration
- `reset_last` - Last statistics reset timestamp

### Artisan Commands

[](#artisan-commands)

#### Reset Statistics

[](#reset-statistics)

Reset statistics for a specific materialized view:

```
php artisan mvstats:reset-stats schema.view_name
```

Reset statistics for all materialized views:

```
php artisan mvstats:reset-stats --all
```

### Examples

[](#examples)

Query views that haven't been refreshed in the last 24 hours:

```
SELECT mv_name, refresh_mv_last
FROM public.tr1884_mvstats_vw_matv_stats
WHERE refresh_mv_last  0
ORDER BY avg_refresh_time DESC;
```

Uninstallation
--------------

[](#uninstallation)

### Option 1: Keep Historical Data

[](#option-1-keep-historical-data)

1. Remove the package:

```
composer remove trogers1884/laravel-mvstats
```

2. The database objects will remain for historical reference.

### Option 2: Complete Removal

[](#option-2-complete-removal)

1. First, remove all database objects:

```
SELECT public.tr1884_mvstats_fn_mv_drop_objects();
```

2. Then remove the package:

```
composer remove trogers1884/laravel-mvstats
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please see [SECURITY.md](SECURITY.md) for reporting procedures.

Credits
-------

[](#credits)

- [Tom Rogers](https://github.com/trogers1884)
- Jeremy Gleed (jeremy\_gleed at yahoo.com)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

566d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.0.1PHP ^8.1|^8.2|^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/641590?v=4)[Tom Rogers](/maintainers/trogers1884)[@trogers1884](https://github.com/trogers1884)

---

Top Contributors

[![trogers1884](https://avatars.githubusercontent.com/u/641590?v=4)](https://github.com/trogers1884 "trogers1884 (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/trogers1884-laravel-mvstats/health.svg)

```
[![Health](https://phpackages.com/badges/trogers1884-laravel-mvstats/health.svg)](https://phpackages.com/packages/trogers1884-laravel-mvstats)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[laravel-liberu/laravel-gedcom

A package that converts gedcom files to Eloquent models

782.5k1](/packages/laravel-liberu-laravel-gedcom)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
