# SQL extensions: Query behind a metric

**URL:** <https://community.dynatrace.com/t/sql-extensions-query-behind-a-metric/52466>\
**Category:** Troubleshooting\
**Tags:** sql, extensions\
**Created:** [July 16, 2025, 5:28am UTC](https://community.dynatrace.com/t/sql-extensions-query-behind-a-metric/52466 "2025-07-16T05:28:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrzej-skiba](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/andrzej-skiba/32/35848_2.png) [@andrzej-skiba](https://community.dynatrace.com/u/andrzej-skiba)\
**Post date:** [July 16, 2025, 5:28am UTC](https://community.dynatrace.com/t/sql-extensions-query-behind-a-metric/52466/1 "2025-07-16T05:28:38Z")

</div>

# Summary

This troubleshooting guide will help you look up the SQL query that is running to pull data for a particular metric for a SQL extension.

# Problem

When working with metric data generated by a SQL extension sometimes it’s useful to know the SQL query that generated the metrics to understand that data batter.

# Troubleshooting steps

1. Go to HUB tile → Download (Release Notes / expand version → Download Version). Read file extension.zip/extension.yaml from the zip file.
2. Find sql\* section (sqlOracle, sqlPostgres etc)
3. Look in the extension.yaml for a metric key. It will be besides a specific query. For example:

```markup
interval: 
    minutes: var:query-interval 
    query: > 
      SELECT  
            CONT.NAME, 
            CAST(CONT.OPEN_TIME AS DATE) AS OPEN_TIME_CASTED, 
            CONT.OPEN_MODE, 
            CONT.RESTRICTED, 
            INST.INSTANCE_NAME, 
            CDB.CDB_NAME 
        FROM 
            GV$CONTAINERS CONT 
            JOIN GV$INSTANCE INST ON INST.INST_ID = CONT.INST_ID 
            CROSS JOIN (SELECT sys_context('USERENV', 'CDB_NAME') as CDB_NAME FROM DUAL) CDB 
    metrics: 
      - key: com.dynatrace.extension.sql-oracle.database_topology 
        value: const:1

```

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [July 16, 2025, 9:23am UTC](https://community.dynatrace.com/t/sql-extensions-query-behind-a-metric/52466/2 "2025-07-16T09:23:30Z")

</div>

Nice tip!&nbsp;:money\_mouth\_face:
