Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-44817

SPIP: Incremental Stats Collection

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.5.0, 4.0.0
    • None
    • SQL
    • None

    Description

      Spark's Cost Based Optimizer is dependent on the table and column statistics.

      After every execution of DML query, table and column stats are invalidated if auto update of stats collection is not turned on. To keep stats updated we need to run `ANALYZE TABLE COMPUTE STATISTICS` command which is very expensive. It is not feasible to run this command after every DML query.

      Instead, we can incrementally update the stats during each DML query run itself. This way our table and column stats would be fresh at all the time and CBO benefits can be applied. Initially, we can only update table level stats and gradually start updating column level stats as well.

      Pros:

      1. Optimize queries over table which is updated frequently.
      2. Saves Compute cycles by removing dependency over `ANALYZE TABLE COMPUTE STATISTICS` for updating stats.

      SPIP Document 

      Attachments

        Activity

          People

            Unassigned Unassigned
            rakson Rakesh Raushan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: