Class SqlStatisticsProvider

java.lang.Object
mondrian.spi.impl.SqlStatisticsProvider
All Implemented Interfaces:
StatisticsProvider

public class SqlStatisticsProvider extends Object implements StatisticsProvider
Implementation of StatisticsProvider that generates SQL queries to count rows and distinct values.
  • Constructor Details

    • SqlStatisticsProvider

      public SqlStatisticsProvider()
  • Method Details

    • getTableCardinality

      public long getTableCardinality(Dialect dialect, DataSource dataSource, String catalog, String schema, String table, Execution execution)
      Description copied from interface: StatisticsProvider
      Returns an estimate of the number of rows in a table.
      Specified by:
      getTableCardinality in interface StatisticsProvider
      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

      public long getQueryCardinality(Dialect dialect, DataSource dataSource, String sql, Execution execution)
      Description copied from interface: StatisticsProvider
      Returns an estimate of the number of rows returned by a query.
      Specified by:
      getQueryCardinality in interface StatisticsProvider
      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

      public long getColumnCardinality(Dialect dialect, DataSource dataSource, String catalog, String schema, String table, String column, Execution execution)
      Description copied from interface: StatisticsProvider
      Returns an estimate of the number of rows in a table.
      Specified by:
      getColumnCardinality in interface StatisticsProvider
      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