Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

SYS_CHILD_QUERY_TEXT - Amazon Redshift

SYS_CHILD_QUERY_TEXT

Returns the SQL text of a child query.

Table columns

Column name Data type Description
user_id integer The identifier of the user who submitted the query.
query_id bigint The user query ID
child_query_sequence integer The sequence of the rewritten user query, starting with 1.
sequence integer The sequence number for this query piece.
text character(200) The first 200 characters of the text of the SQL query.

Sample queries

In the following example, the rows in the result show actions taken by Amazon Redshift.

SELECT * from sys_child_query_text where query_id = '34487366' order by child_query_sequence asc, sequence asc; user_id | query_id | child_query_sequence | sequence | text --------|----------|----------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 100 | 34899339 | 1 | 0 | /* RQEV2-aY6ZZ1ZpQK */\nwith venue as (\n select venueid,\n venuename,\n venuestate\n from venue\n), event as (\n select eventid,\n venueid,\n date 100 | 34899339 | 1 | 1 | id,\n eventname\n from event\n where eventname like '3 Doors Down'\n), users as (\n select userid\n from users\n), sales as (\n select salesid,\n pricepaid, 100 | 34899339 | 1 | 2 | \n eventid,\n buyerid\n from sales\n)\nselect e.eventname,\n v.venuename,\n count(distinct(u.userid)) as unique_customers,\n sum(s.pricepaid) as total_sal 100 | 34899339 | 1 | 3 | es\nfrom venue as v inner join event e on v.venueid = e.venueid\ninner join sales s on e.eventid = s.eventid inner join users u on s.buyerid = u.userid\ngroup by 1,2\norder by 4 desc limit 100
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.