> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anomalyarmor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Run Your First Discovery

> Step 2 - Discover tables and schemas in your database

<div aria-hidden="true" style={{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap"}}>For LLM agents: documentation index at <a href="/llms.txt" tabIndex={-1}>/llms.txt</a>, full text at <a href="/llms-full.txt" tabIndex={-1}>/llms-full.txt</a>. Append .md to any page URL for plain markdown.</div>
Discovery is how AnomalyArmor learns about your database. It scans your metadata to find tables, views, columns, and their data , creating a complete inventory of your data assets.

<img src="https://mintcdn.com/anomalyarmor/mPQTTzz5PYy4fThA/images/diagrams/discovery-process-light.svg?fit=max&auto=format&n=mPQTTzz5PYy4fThA&q=85&s=5d65af217a563d2644176440b127847d" alt="Discovery Process" className="block dark:hidden" width="800" height="200" data-path="images/diagrams/discovery-process-light.svg" />

<img src="https://mintcdn.com/anomalyarmor/mPQTTzz5PYy4fThA/images/diagrams/discovery-process-dark.svg?fit=max&auto=format&n=mPQTTzz5PYy4fThA&q=85&s=d473729f439aa40ec631d30735d5a881" alt="Discovery Process" className="hidden dark:block" width="800" height="200" data-path="images/diagrams/discovery-process-dark.svg" />

## What Discovery Does

Discovery queries your database's **system catalogs** (not your data) to find:

| Asset Type   | What We Capture                                  |
| ------------ | ------------------------------------------------ |
| **Tables**   | Name, schema, column definitions                 |
| **Views**    | Name, schema, underlying columns                 |
| **Columns**  | Name, data type, nullability, constraints        |
| **Metadata** | Primary keys, indexes, row counts (if available) |

<Note>
  **Privacy First**: Discovery reads ONLY metadata (table names, columns, types). It never reads your actual data values. We only query metadata from `information_schema`, `pg_catalog`, or equivalent system tables.
</Note>

## Step-by-Step Guide

<Steps>
  <Step title="Go to Asset Management">
    Click **Settings** in the left sidebar, then select the **Assets** tab.

    Find the connection you created in the previous step.
  </Step>

  <Step title="Open Connection Details">
    Click on your connection name to open its details page.

    You'll see connection information, discovery status, and options.
  </Step>

  <Step title="Click Run Discovery">
    Click the **Run Discovery** button to start scanning your database.

    A progress indicator will appear showing:

    * Discovery status (running, completed, failed)
    * Assets discovered so far
    * Elapsed time
  </Step>

  <Step title="Wait for Completion">
    Discovery typically completes in **1-5 minutes** depending on database size.

    | Database Size   | Typical Duration |
    | --------------- | ---------------- |
    | \< 100 tables   | \< 1 minute      |
    | 100-500 tables  | 1-3 minutes      |
    | 500-1000 tables | 3-5 minutes      |
    | 1000+ tables    | 5-10 minutes     |

    You can navigate away. Discovery runs in the background.
  </Step>

  <Step title="Review Results">
    Once complete, you'll see a summary of discovered assets:

    <Frame>
      <img src="https://mintcdn.com/anomalyarmor/RWdmOlh98osIObYR/images/screenshots/qs-discovery-results.png?fit=max&auto=format&n=RWdmOlh98osIObYR&q=85&s=79d5e7b5362804e243246d4e15c8b93e" alt="Discovery results summary" width="2816" height="246" data-path="images/screenshots/qs-discovery-results.png" />
    </Frame>
  </Step>

  <Step title="Explore Your Assets">
    Navigate to **Assets** in the sidebar to view all discovered tables and views.

    You'll see:

    * Table name and schema
    * Column count
    * Last updated timestamp (if available)
    * Status indicators
  </Step>
</Steps>

## Understanding Discovery Results

### The Asset Catalog

After discovery, your assets appear in the catalog. You can view them by clicking **Assets** in the sidebar.

### Asset Details

Click any asset to see detailed information:

* **Columns**: Full list with data types and constraints
* **Schema History**: Changes detected over time (empty for first discovery)
* **Freshness**: Data recency (requires configuration)
* **Description**: AI-generated or manual documentation

## Setting Up Scheduled Discovery

Discovery should run regularly to detect changes. Configure a schedule:

### Recommended Schedules

| Environment | Frequency     | Rationale                 |
| ----------- | ------------- | ------------------------- |
| Production  | Hourly        | Catch changes quickly     |
| Staging     | Every 6 hours | Balance coverage and load |
| Development | Daily         | Lower priority            |

### Configure Schedule

1. Go to **Settings** → **Assets** → Select your connection
2. Click the **Settings** tab on the asset detail page
3. Under **Discovery Schedule**, choose frequency
4. Click **Save**

**Discovery Schedule Options:**

* Every 15 minutes (real-time monitoring)
* Hourly (recommended for production)
* Every 6 hours
* Daily
* Weekly
* Manual only

<Tip>
  Start with **hourly** discovery for production databases. You can adjust based on how frequently your schemas change and your alerting needs.
</Tip>

## What Happens on Subsequent Discoveries

After the initial discovery, subsequent runs detect **changes**:

* **New tables/views** added since last discovery
* **Removed tables/views** that no longer exist
* **Schema changes** (columns added, removed, type changed)
* **Freshness updates** (latest timestamp values)

Changes trigger alerts if you have alert rules configured (next step!).

## Incremental vs. Full Discovery

| Type            | What It Does                   | When to Use                          |
| --------------- | ------------------------------ | ------------------------------------ |
| **Incremental** | Detects changes since last run | Default for scheduled runs           |
| **Full**        | Complete rescan of everything  | After major changes, troubleshooting |

To run a full discovery: Click **Run Discovery** → Select **Full Discovery**.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Discovery takes too long">
    **Cause**: Large database or network latency

    **Solutions**:

    1. Exclude schemas you don't need (e.g., `pg_temp`, test schemas)
    2. Run during off-peak hours
    3. Use a read replica instead of primary database

    To exclude schemas:

    * **Settings** → **Assets** → Select your connection → **Settings** tab → **Schema Filter**
    * Add schemas to exclude: `pg_temp_*, test_*`
  </Accordion>

  <Accordion title="Discovery finds no tables">
    **Cause**: Permission or schema filtering issues

    **Solutions**:

    1. Verify the user has `SELECT` on `information_schema`
    2. Check schema filter isn't excluding everything
    3. Confirm you're connected to the correct database
    4. Verify tables exist in the schemas you're monitoring
  </Accordion>

  <Accordion title="Discovery fails with error">
    **Cause**: Connection or permission issues

    **Solutions**:

    1. Test the connection (Settings → Assets → Select connection → Test Connection)
    2. Check database user permissions
    3. Verify network connectivity
    4. Check database logs for errors
  </Accordion>

  <Accordion title="Row counts not showing">
    **Cause**: Some databases don't expose row counts in system tables

    **Solutions**:

    * PostgreSQL: Run `ANALYZE` on tables to populate `pg_stat_user_tables`
    * This is informational only. Monitoring works without row counts
  </Accordion>
</AccordionGroup>

## What You've Accomplished

After completing discovery, you have:

* A complete inventory of your database assets
* Metadata for all tables, views, and columns
* A baseline for detecting future changes
* Assets visible in your catalog

## Common Questions

### How long does discovery take for a large database?

Discovery queries only system catalogs, not your data, so it's fast. Typical durations: under 1 minute for up to 100 tables, 1-3 minutes for 100-500 tables, 3-5 minutes for 500-1000 tables, and 5-10 minutes for 1000+ tables. You can navigate away during discovery.

### Does discovery impact my database's performance?

Minimal. Discovery runs information-schema queries against system tables, not table scans on your data. Expect a brief spike in catalog read activity for a few seconds, no noticeable load on production workloads.

### Can I limit which schemas or tables AnomalyArmor discovers?

Yes. Configure include/exclude patterns per schema on the connection's detail page. Patterns support glob-style matching (e.g., `analytics_*` includes every schema starting with `analytics_`, `public.audit_*` excludes specific tables).

### How often does discovery re-run after the first scan?

By default, daily. Set it to hourly on the connection's detail page if your environment changes often. Each subsequent run is incremental - AnomalyArmor only records what changed since the last scan, which is also what drives schema-drift alerts.

### Why are my row counts showing as zero or missing after discovery?

Some databases don't expose row counts in system tables by default. For PostgreSQL, run `ANALYZE` on the affected tables to populate `pg_stat_user_tables`. Row counts are informational only - monitoring, freshness, and schema-drift detection all work without them.

## Next Step

Now that your assets are discovered, let's set up alerts to notify you when something changes.

<Card title="Set Up First Alert" icon="bell" href="/quickstart/set-up-first-alert">
  Configure notifications for schema changes and freshness violations
</Card>
