Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Anti-pattern Recognition tool to the Optimization Scripts #397

Merged
merged 9 commits into from
Mar 25, 2024
Prev Previous commit
Next Next commit
using viewable_queries_grouped_by_hash for anti pattern processing
  • Loading branch information
franklinWhaite committed Mar 24, 2024
commit 7827360d865514af1d57090e506a7443d00938f6
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SELECT
query_hash id,
top_10_jobs[SAFE_OFFSET(0)].query_text query
FROM
`pso-dev-cs-cdwp.optimization_workshop.queries_grouped_by_hash`
optimization_workshop.viewable_queries_grouped_by_hash
ORDER BY
avg_total_slots desc
LIMIT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ALTER TABLE optimization_workshop.queries_grouped_by_hash
ALTER TABLE optimization_workshop.viewable_queries_grouped_by_hash
ADD COLUMN recommendation ARRAY<STRUCT<name STRING, description STRING>>;

UPDATE optimization_workshop.queries_grouped_by_hash t1
UPDATE optimization_workshop.viewable_queries_grouped_by_hash t1
SET t1.recommendation = t2.recommendation
FROM optimization_workshop.antipattern_output_table t2
WHERE t1.query_hash = t2.job_id;