<@U0A71G31CDV> why query detail api querySource is...
# questions-and-troubleshooting
z
@Rocky why query detail api querySource is always EXETRNAL? and why I cant see real queries
1
r
The Query Detail API (and the associated
querySource
field) behaves this way based on your StarRocks cluster's configuration and the nature of the queries being executed. 1. Why
querySource
is always
EXTERNAL
The
querySource
field identifies the origin of a query. In the Query Detail API, you will primarily see the following values: *
EXTERNAL
: Queries submitted by users or external applications (e.g., via MySQL client, JDBC, or BI tools). This is the default for almost all manual or application-driven traffic. *
INTERNAL
: Queries generated by StarRocks' internal components (e.g., schema changes or internal statistics collection). *
MV
: Refresh tasks for Materialized Views. *
TASK
: Executions related to asynchronous Tasks. If you only see
EXTERNAL
, it usually means you are only looking at your own user-initiated queries, and either no background tasks (like MVs) are running or the system is not capturing internal SQL. 2. Why you can't see the "real" queries (SQL Text) If the
sql
field in the API response is empty, masked, or shows only a
?
, it is likely due to one of these FE configurations: *
enable_sql_desensitize_in_log
: If this is set to
true
, StarRocks replaces or hides sensitive SQL content before writing it to logs and query-detail records. This is a security feature to prevent leaking credentials or sensitive data in literals. _ _To check:*
SHOW FRONTENDS;
(look for configuration) or check
fe.conf
. *
enable_internal_sql
: When this is
false
(default is
true
), internal SQL text is suppressed and will return
?
or not be emitted at all. This might explain why you don't see the "real" logic for system-level queries. *
enable_collect_query_detail_info
: This must be
true
for the API to return any data at all. If it's
false
, the cache remains empty. * SQL Digest: If the system is configured to only show digests for performance or security reasons, the full SQL text will be unavailable, and you may only see a hash in the
digest
field. How to fix it If you want to see the full SQL for debugging purposes and have the necessary permissions: 1. Disable Desensitization: Set
enable_sql_desensitize_in_log = false
in your
fe.conf
(requires a restart for non-dynamic changes, though check if it's mutable in your version). 2. Verify Collection: Ensure
ADMIN SET FRONTEND CONFIG ("enable_collect_query_detail_info" = "true");
is executed. 3. Check Internal Queries: Ensure
enable_internal_sql = true
if you are trying to see what the system is doing in the background. Note: If you are using the
query_dump
API instead of the Query Detail API, you can bypass desensitization by adding
mock=false
to the URI (e.g.,
/api/query_dump?db=mydb&mock=false
). Referencesadministration/management/FE_configuration.mdadministration/http_interface/query_detail.mdfaq/Dump_query.md