ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Analyze Datasets

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Updates database statistics of base tables, delta tables, and archive tables, along with the statistics on those tables' indexes. This tool is used in enterprise geodatabases to help get optimal performance from the RDBMS's query optimizer. Stale statistics can lead to poor geodatabase performance.

Usage

  • The input workspace must be an enterprise database. Analyze Datasets does not work with file or personal geodatabases.
  • After data loading, deleting, updating, and compressing operations, it is important to update RDBMS statistics in Oracle, SQL Server, DB2, PostgreSQL, or Informix databases.
  • The option Include System Tables is used to determine if the states and state lineage tables will be analyzed. When the option is unselected, these tables are not analyzed; when selected, the tables are analyzed.
  • When working with tables or datasets, this tool updates the statistics of base tables, delta tables, and archive tables, along with the statistics on those tables' indexes.
  • The Datasets to Analyze parameter's Add Value button is used only in ModelBuilder. In ModelBuilder, where the preceding tool has not been run, or its derived data does not exist, the Datasets to Analyze parameter may not be populated with values. The Add Value button allows you to add expected values so you can continue to build your model.

Syntax

AnalyzeDatasets_management (input_database, include_system, {in_datasets}, {analyze_base}, {analyze_delta}, {analyze_archive})
ParameterExplanationData Type
input_database

The enterprise database that contains the data to be analyzed.

Workspace
include_system

Indicates whether statistics will be gathered on the states and state lineages tables.

Note:

You must be the geodatabase administrator for this option to be activated.

This option only applies to geodatabases. If the input workspace is a database, this option will be ignored.

  • NO_SYSTEM —Statistics will not be gathered on the states and state lineages tables. This is the default.
  • SYSTEM —Statistics will be gathered on the states and state lineages tables.
Boolean
in_datasets
[in_datasets,...]
(Optional)

Names of the datasets that will be analyzed. An individual dataset or a Python list of datasets is allowed. Dataset names use paths relative to the input workspace; full paths are not accepted as input.

Note that the connected user must be the data owner for the datasets provided.

String
analyze_base
(Optional)

Indicates whether the selected dataset base tables will be analyzed.

This option only applies to geodatabases. If the input workspace is a database, this option will be ignored.

  • ANALYZE_BASE — Statistics will be gathered on the base tables for the selected datasets. This is the default.
  • NO_ANALYZE_BASE — Statistics will not be gathered for the base tables for the selected datasets.
Boolean
analyze_delta
(Optional)

Indicates whether the selected dataset delta tables will be analyzed.

This option only applies to geodatabases. If the input workspace is a database, this option will be ignored.

  • ANALYZE_DELTA — Statistics will be gathered on the delta tables for the selected datasets. This is the default.
  • NO_ANALYZE_DELTA — Statistics will not be gathered for the delta tables for the selected datasets.
Boolean
analyze_archive
(Optional)

Indicates whether the selected dataset archive tables will be analyzed.

This option only applies to geodatabases. If the input workspace is a database, this option will be ignored.

  • ANALYZE_ARCHIVE — Statistics will be gathered on the archive tables for the selected datasets. This is the default.
  • NO_ANALYZE_ARCHIVE — Statistics will not be gathered for the archive tables for the selected datasets.
Boolean

Code sample

AnalyzeDatasets example 1 (Python window)

The following Python window script demonstrates how to use the Analyze Datasets tool in immediate mode.

# Import system modules
import arcpy

arcpy.AnalyzeDatasets_management("c:/Connections/tenone@sde.sde",
                                 "SYSTEM",
                                 "gdb.city;gdb.state;map.lines",
                                 "ANALYZE_BASE",
                                 "ANALYZE_DELTA",
                                 "ANALYZE_ARCHIVE")
AnalyzeDatasets example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the Analyze Datasets tool to analyze all datasets for a given user connection.

# Name: AnalyzeDatasets.py
# Description: analyzes all datasets in an enterprise geodatabase
#              for a given user.

# Import system modules
import arcpy
import os

# set workspace
# the user in this workspace must be the owner of the data to analyze.
workspace = arcpy.GetParameterAsText(0)

# set the workspace environment
arcpy.env.workspace = workspace

# NOTE: Analyze Datasets can accept a Python list of datasets.

# Get a list of all the datasets the user has access to.
# First, get all the stand alone tables, feature classes and rasters.
dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters()

# Next, for feature datasets get all of the datasets and featureclasses
# from the list and add them to the master list.
for dataset in arcpy.ListDatasets("", "Feature"):
    arcpy.env.workspace = os.path.join(workspace,dataset)
    dataList += arcpy.ListFeatureClasses() + arcpy.ListDatasets()

# reset the workspace
arcpy.env.workspace = workspace

# Get the user name for the workspace
userName = arcpy.Describe(workspace).connectionProperties.user.lower()

# remove any datasets that are not owned by the connected user.
userDataList = [ds for ds in dataList if ds.lower().find(".%s." % userName) > -1]

# Execute analyze datasets
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.AnalyzeDatasets_management(workspace, "NO_SYSTEM", dataList, "ANALYZE_BASE","ANALYZE_DELTA","ANALYZE_ARCHIVE")
print("Analyze Complete")

Environments

  • Current Workspace

Licensing information

  • ArcGIS for Desktop Basic: No
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Geodatabase Administration toolset

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal