Skip to content

Remove table_describe join to index tables #209

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions lib/queries/table_describe.sql
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,16 @@ FROM <table_catalog>.INFORMATION_SCHEMA.TABLES st
AND sc.TABLE_NAME = u.TABLE_NAME
AND sc.COLUMN_NAME = u.COLUMN_NAME
cross join t_name_cte r
INNER JOIN
INNER JOIN
<table_catalog>.sys.columns c ON c.name = sc.column_name
INNER JOIN
<table_catalog>.sys.types t ON c.user_type_id = t.user_type_id
INNER JOIN
<table_catalog>.sys.tables ta ON ta.name = r.table_name
LEFT OUTER JOIN
<table_catalog>.sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id
LEFT OUTER JOIN
<table_catalog>.sys.indexes i ON ic.object_id = i.object_id AND ic.index_id = i.index_id
WHERE
c.object_id = ta.object_id
AND TABLE_TYPE = 'BASE TABLE'
AND sc.TABLE_NAME = r.table_name
AND (sc.TABLE_SCHEMA = '<table_schema>' or '<table_schema>' = '')
AND (ta.schema_id = SCHEMA_ID('<table_schema>') or '<table_schema>' = '')