Package mondrian.spi

Interface StatisticsProvider

All Known Implementing Classes:
JdbcStatisticsProvider, SqlStatisticsProvider

public interface StatisticsProvider
Provides estimates of the number of rows in a database.

Mondrian generally finds statistics providers via the Dialect.getStatisticsProviders() method on the dialect object for the current connection. The default implementation of that method looks first at the "mondrian.statistics.providers.DATABASE" property (substituting the current database name, e.g. MYSQL or ORACLE, for DATABASE), then at the "mondrian.statistics.providers" property.

See Also:
  • Method Details

    • getTableCardinality

      long getTableCardinality(Dialect dialect, DataSource dataSource, String catalog, String schema, String table, Execution execution)
      Returns an estimate of the number of rows in a table.
      Parameters:
      dialect - Dialect
      dataSource - Data source
      catalog - Catalog name
      schema - Schema name
      table - Table name
      execution - Execution
      Returns:
      Estimated number of rows in table, or -1 if there is no estimate
    • getQueryCardinality

      long getQueryCardinality(Dialect dialect, DataSource dataSource, String sql, Execution execution)
      Returns an estimate of the number of rows returned by a query.
      Parameters:
      dialect - Dialect
      dataSource - Data source
      sql - Query, e.g. "select * from customers where age < 20"
      execution - Execution
      Returns:
      Estimated number of rows returned by query, or -1 if there is no estimate
    • getColumnCardinality

      long getColumnCardinality(Dialect dialect, DataSource dataSource, String catalog, String schema, String table, String column, Execution execution)
      Returns an estimate of the number of rows in a table.
      Parameters:
      dialect - Dialect
      dataSource - Data source
      catalog - Catalog name
      schema - Schema name
      table - Table name
      column - Column name
      execution - Execution
      Returns:
      Estimated number of rows in table, or -1 if there is no estimate