> For the complete documentation index, see [llms.txt](https://upsolver.gitbook.io/content/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upsolver.gitbook.io/content/how-to-guides-1/apache-iceberg/analyze-your-iceberg-tables-using-the-upsolver-cli.md).

# Analyze Your Iceberg Tables Using the Upsolver CLI

## Overview

The Iceberg Table Analysis CLI Tool evaluates your Apache Iceberg tables to identify how Upsolver optimizations can enhance efficiency. It presents a side-by-side comparison of current metrics against potential improvements in scan duration, file counts, and file sizes, providing a straightforward assessment of optimization opportunities.

The following example shows the output from running the CLI against an Iceberg table to check the current performance metrics:

<figure><img src="/files/3mM0frVZ5gbCT6lgr2o5" alt=""><figcaption><p>Example of the CLI output</p></figcaption></figure>

## Installation

`iceberg-diag` can be installed using either Brew or PIP, as detailed below:

### Using Brew

Execute the following commands to install `iceberg-diag` via Brew:

```
brew tap upsolver/iceberg-diag
brew install iceberg-diag
```

### Using PIP

**Prerequisites**

* **Python 3.8 or higher**: Verify Python's installation:

  ```
  python3 --version
  ```
* **Rust**: check if installed:

  ```
  cargo --version
  ```

  If Rust is not installed, install it using:

  ```
  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  ```

To install `iceberg-diag` using PIP, ensure you have the latest version of `pip`:

```
pip install --upgrade pip
```

Then, install the package with `pip`

```
pip install iceberg-diag
```

## Usage Instructions

```
iceberg-diag [options]
```

### Command-Line Options

* `-h`, `--help`: Display the help message and exit.
* `--profile PROFILE`: Set the AWS credentials profile for the session, defaults to the environment's current settings.
* `--region REGION`: Set the AWS region for operations, defaults to the specified profile's default region.
* `--database DATABASE`: Set the database name, will list all available iceberg tables if no `--table-name` provided.
* `--table-name TABLE_NAME`: Enter the table name or a glob pattern (e.g., `'*'`, `'tbl_*'`).
* `--remote`: Enable remote diagnostics by sending data to the Upsolver API for processing.\
  The 'Remote' option yields more detailed analytics compared to running the process locally.

### Usage

1. Displaying help information:

   ```
    iceberg-diag --help
   ```
2. Listing all available databases in profile:

   ```
   iceberg-diag --profile <profile>
   ```
3. Listing all available iceberg tables in a given database:

   ```
   iceberg-diag --profile <profile> --database <database>
   ```
4. Running diagnostics on a specific table in a specific AWS profile and region (completely locally):

   ```
    iceberg-diag --profile <profile> --region <region> --database <database> --table-name '*'
   ```
5. Running diagnostics using `remote` option

   ```
   iceberg-diag --profile <profile> --database <database> --table-name 'prod_*' --remote
   ```

### Source Code

The source code of Iceberg diagnostic tool can be found here:

<https://github.com/Upsolver/iceberg-diag>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://upsolver.gitbook.io/content/how-to-guides-1/apache-iceberg/analyze-your-iceberg-tables-using-the-upsolver-cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
