Hi,
Context and issue description
I have an aws account that containg data stored in S3 Bucket in parquet format. I have shared this data with other account to create quicksight dashboards.
I am using Athena to import this data (as direct query) to quicksight, It generate almost all charts I need just one chart rise me the error "The data source's limits on server resources are temporarily exceeded by this query's execution. Try to simplify the query or reduce the size of the dataset".
I have opened the query in Athena and when I try to run it manually it rise the error "Query exhausted resources at this scale factor" (running statistics: Run time:31.281 sec, Data scanned:10.34 GB)
When I perform a "select * from my_database.my_table" it run in less than 2 minutes and scan 514MB of data. The queryes executed by athena to create other charts (sucessfully) give me running statistics like Run time:18.914 sec, Data scanned: 71.79 GB.
When I try ti import the data to quicksight using SPICE method it rise me the error "A general SQL error occurred. This error can be caused by query timeouts, resource constraints, unexpected data definition language (DDL) changes before or during a query, and other database errors. Check your database settings and your query, and try again."
More informations about the setup below. Do you guys know which can be the cause and how to solve it ?
Cross account share method
To share the data with the other account I have:
- Allowed access from consumer account to the Glue catalog in provider account

- Allowed access to the S3 bucket of the provider account
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<<CONSUMER-ACCOUNT-ID>>:root"
},
"Action": "s3:GetObject",
"Resource": "<<YOUR-BUCKET-ARN>>"
}
]
}
-
Consumer account added to the Access control list (ACL) of the bucket in provider account with the rights to list objects and read for bucket ACL
-
Created a data source in consumer account as a "S3 - AWS Glue data catalogue" filled the form with data source name and provider account ID
Athena workgroup setup and query
- The workgroup settings can be found in the next image (already tried with the maximum value of 7PB)

- Query automatic generated by quicksight:
/* QuickSight cf90002b-7ab4-4af3-afda-8c650a992256
{"partner":"QuickSight","entityId":"c6b445ed-6b03-4d4d-a9a2-d9d90778494e","sheetId":"80b03065-2e67-43ca-96e2-3476621b14ee","visualId":"b6900a2d-5d49-484e-a102-99cba6c947b8"} */
SELECT "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg", "isotherrow_1", "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub", "isotherrow_2", "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_van1010_distinct_count", "count"
FROM (
SELECT CASE WHEN "t"."$RANK_1" > 50 THEN NULL ELSE "t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg" END AS "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg", CASE WHEN "t"."$RANK_1" > 50 THEN NULL ELSE "t"."$RANK_1" END AS "$f26", CASE WHEN "t"."$RANK_1" > 50 THEN 1 ELSE 0 END AS "isotherrow_1", CASE WHEN "t"."$RANK_1" > 50 OR "t"."$RANK_2" > 50 THEN NULL ELSE "t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub" END AS "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub", CASE WHEN "t"."$RANK_1" > 50 OR "t"."$RANK_2" > 50 THEN NULL ELSE "t"."$RANK_2" END AS "$f29", CASE WHEN "t"."$RANK_1" > 50 OR "t"."$RANK_2" > 50 THEN 1 ELSE 0 END AS "isotherrow_2", COUNT(DISTINCT "t0"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_van1010") AS "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_van1010_distinct_count", COUNT(*) AS "count"
FROM (
SELECT "c_hub" AS "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub", date_trunc('week', CAST(CAST(PARSE_DATETIME("p_date", 'yyyy-MM-dd') AS TIMESTAMP) AS TIMESTAMP) + INTERVAL '1' day) - INTERVAL '1' day AS "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg", DENSE_RANK() OVER (ORDER BY date_trunc('week', CAST(CAST(PARSE_DATETIME("p_date", 'yyyy-MM-dd') AS TIMESTAMP) AS TIMESTAMP) + INTERVAL '1' day) - INTERVAL '1' day DESC) AS "$RANK_1", DENSE_RANK() OVER (PARTITION BY date_trunc('week', CAST(CAST(PARSE_DATETIME("p_date", 'yyyy-MM-dd') AS TIMESTAMP) AS TIMESTAMP) + INTERVAL '1' day) - INTERVAL '1' day ORDER BY COUNT(DISTINCT "c_van1010") DESC, "c_hub" NULLS FIRST) AS "$RANK_2"
FROM "KpieCatalog"."vehicle_ccpu_data_asset_sem"."t_session_level_header_drives_id8_global"
GROUP BY "c_hub", date_trunc('week', CAST(CAST(PARSE_DATETIME("p_date", 'yyyy-MM-dd') AS TIMESTAMP) AS TIMESTAMP) + INTERVAL '1' day) - INTERVAL '1' day
) AS "t"
INNER JOIN (
SELECT "c_van1010" AS "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_van1010", "c_hub" AS "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub", date_trunc('week', CAST(CAST(PARSE_DATETIME("p_date", 'yyyy-MM-dd') AS TIMESTAMP) AS TIMESTAMP) + INTERVAL '1' day) - INTERVAL '1' day AS "a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg"
FROM "KpieCatalog"."vehicle_ccpu_data_asset_sem"."t_session_level_header_drives_id8_global"
) AS "t0" ON ("t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg" = "t0"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg" OR "t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg" IS NULL AND "t0"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg" IS NULL OR "t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg" IS NULL AND "t0"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg" IS NULL) AND ("t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub" = "t0"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub" OR "t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub" IS NULL AND "t0"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub" IS NULL OR "t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub" IS NULL AND "t0"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub" IS NULL)
GROUP BY CASE WHEN "t"."$RANK_1" > 50 THEN NULL ELSE "t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.p_date_tg" END, CASE WHEN "t"."$RANK_1" > 50 THEN NULL ELSE "t"."$RANK_1" END, CASE WHEN "t"."$RANK_1" > 50 THEN 1 ELSE 0 END, CASE WHEN "t"."$RANK_1" > 50 OR "t"."$RANK_2" > 50 THEN NULL ELSE "t"."a5d4a71c-5aaa-4114-953b-8ac51aa8b558.c_hub" END, CASE WHEN "t"."$RANK_1" > 50 OR "t"."$RANK_2" > 50 THEN NULL ELSE "t"."$RANK_2" END, CASE WHEN "t"."$RANK_1" > 50 OR "t"."$RANK_2" > 50 THEN 1 ELSE 0 END
ORDER BY CASE WHEN "t"."$RANK_1" > 50 THEN NULL ELSE "t"."$RANK_1" END NULLS FIRST, CASE WHEN "t"."$RANK_1" > 50 OR "t"."$RANK_2" > 50 THEN NULL ELSE "t"."$RANK_2" END NULLS FIRST
) AS "t1"