Skip to content

[ISSUE-6162] Upgrade RS SQL statement query - #6188

Merged
pmbrull merged 2 commits into
open-metadata:mainfrom
Beetelbrox:ISSUE-6162-redshift-usage-ingestion-query
Jul 19, 2022
Merged

pmbrull merged 2 commits into
open-metadata:mainfrom
Beetelbrox:ISSUE-6162-redshift-usage-ingestion-query

Conversation

@Beetelbrox

@Beetelbrox Beetelbrox commented Jul 19, 2022 •

Copy link
Copy Markdown
Contributor

Related Issue #6162

Describe your changes :

Upgrading the RS SQL statement query as explained here to use STL_QUERYTXT to extract the sql source and apply some optimizations to reduce the number of output columns:

  • Extract full query text for most queries. Truncated at 65535 characters due to RS string type limitation.
  • Limit the queries extracted to the following statements, excluding vacuums, cursor fetches and other automated queries:
    • SELECT, SELECT INTO
    • INSERT, UPDATE, DELETE
    • COPY
    • UNLOAD
    • CREATE TABLE AS (CTAS)
  • Don't fanout queries by table as it seems to be never used downstream and it creates one copy of the query per table scanned. This should help reduce the number of rows ouput.
  • Misc query optimizations to avoid large intermediate results.

Cursors declaration require a completely different query so for now they've been excluded

By checking against yesterday's payload we've reduced the amount of rows returned from 67,058 to 43,502. Still way to go

Comments

From what I've been able to understand from the code & some performance tests the long running times are not necessarily part of the query but the downstream registration of the metadata & sql parsin. We'll need to tackle those too in separate PRs.

Type of change :

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • All new and existing tests passed.

Reviewers:

Ingestion: https://github.com/orgs/open-metadata/teams/ingestion

@Beetelbrox
Beetelbrox temporarily deployed to cypress July 19, 2022 10:49 Inactive
@Beetelbrox
Beetelbrox temporarily deployed to cypress July 19, 2022 10:49 Inactive
@Beetelbrox Beetelbrox changed the title Upgrade RS SQL statement query [ISSUE-6162] Upgrade RS SQL statement query Jul 19, 2022
@Beetelbrox
Beetelbrox temporarily deployed to cypress July 19, 2022 11:08 Inactive
@Beetelbrox
Beetelbrox temporarily deployed to cypress July 19, 2022 11:08 Inactive
@pmbrull
pmbrull requested a review from a team July 19, 2022 11:13
@sonarqubecloud

Copy link
Copy Markdown

[open-metadata-ingestion] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@cypress

cypress Bot commented Jul 19, 2022

Copy link
Copy Markdown



Test summary

47 • 0 • 3 • 0


Run details

Project openmetadata
Status Passed
Commit 18c101d
Started Jul 19, 2022 11:25 AM
Ended Jul 19, 2022 11:37 AM
Duration 12:15 💡
OS Linux Ubuntu - 20.04
Browser Chrome 103

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@pmbrull
pmbrull merged commit 710591f into open-metadata:main Jul 19, 2022
pmbrull pushed a commit to pmbrull/OpenMetadata that referenced this pull request Jul 27, 2022
* Upgrade RS SQL statement query

* Fix query, remove dupes
pmbrull added a commit that referenced this pull request Jul 27, 2022
* Fix #5890 - Add health endpoint (#6030)

* Add health endpoint

* Replace rest_status for health

* Update message

* [ISSUE-6162] Upgrade RS SQL statement query (#6188)

* Upgrade RS SQL statement query

* Fix query, remove dupes

* [ISSUE-6162] Escape wildcards on revised RS query (#6200)

[ISSUE-6162] Escape wildcards on revised RS query (#6200)

* Remove retry in ES query (#6191)

Remove retry in ES query (#6191)

* min/max

* Fix  #6161 - kill endpoint for Airflow REST (#6244)

Fix  #6161 - kill endpoint for Airflow REST (#6244)

* Fixes #6031 & #6236 -- Handle binary field & UUID when ingesting sample data (#6233)

Fixes #6031 & #6236 -- Handle binary field & UUID when ingesting sample data (#6233)

* overwrite default sum function to add super for BQ overflow (#6252)

* [TASK-6241] Cache ES ingestion when ingesting usage (#6276)

* Cache ingestion

* Uncomment secrets manager

* Fix experiment stuff

* Fix style

* Add LRU cache

* Add tests

* Fix code smell

* [TASK-6140] Add OMeta header to SQLAlchemy-based queries (#6293)

[TASK-6140] Add OMeta header to SQLAlchemy-based queries (#6293)

* Fix #6248: Use PUT API instead of POST for tag & tagCategory (#6344)

* Fix #6248: Use PUT API instead of POST for tag & tagCategory

* Restructure yield_tag topology

* Renamed method to create_or_update

* compressed logs

* Update packages

* feat(ui): sync OMD theme with AntD components (#6148)

* feat(ui): sync omd theme with antd components

* update package.json

* fixed failing cypress

* fix layout break issue

Co-authored-by: Shailesh Parmar <[email protected]>
(cherry picked from commit 574dbce)

* Fix sql queries formatting

Co-authored-by: Francisco J. Jurado Moreno <[email protected]>
Co-authored-by: Teddy <[email protected]>
Co-authored-by: Mayur Singal <[email protected]>
Co-authored-by: Chirag Madlani <[email protected]>

This branch was previously deployed

1 inactive deployment
cypress — 18c101db Deployed Jul 19, 2022 by Beetelbrox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants