pg_loose_count.rb

Path: lib/sequel/extensions/pg_loose_count.rb
Last Update: Thu Nov 12 08:45:04 +0000 2015

The pg_loose_count extension looks at the table statistics in the PostgreSQL system tables to get a fast approximate count of the number of rows in a given table:

  DB.loose_count(:table) # => 123456

It can also support schema qualified tables:

  DB.loose_count(:schema__table) # => 123456

How accurate this count is depends on the number of rows added/deleted from the table since the last time it was analyzed.

To load the extension into the database:

  DB.extension :pg_loose_count

[Validate]