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

Performance improvements when query includes sys.indexes.is_primary_key predicate #2917

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
eb19745
To improve the performance of customer query, defining new IMPLICIT c…
Sep 9, 2024
4fc4b52
fixing test failure
Sep 9, 2024
1479f6b
adding test and updating upgrade file
Sep 9, 2024
e0cab1c
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into performanc…
Sep 11, 2024
be50375
Removing has_schema_privilege
Sep 12, 2024
ffdaa8a
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into performanc…
Sep 12, 2024
b6e45d8
updating upgrade file
Sep 12, 2024
e35024e
rerun tests
Sep 12, 2024
6f309e5
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into performanc…
Sep 18, 2024
7b33208
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into performanc…
Sep 20, 2024
cfd1809
removing redundant has_schema_privilege(USAGE) check and updating create
Sep 20, 2024
7b57915
updating the SLA for sys-syscolumns file for parallel mode
Sep 20, 2024
d9c99bc
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into performanc…
Sep 20, 2024
6a44e4f
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into performanc…
Sep 20, 2024
b4ea881
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into performanc…
Sep 25, 2024
c152e39
Adding test cases for redundanct schema permission
Sep 25, 2024
7e3b2f2
making unique names for login and user
Sep 25, 2024
be35f3b
for dump and restore we need to alter the login password
Sep 25, 2024
d6e1556
updating the expected verify file
Sep 25, 2024
786836d
rerun tests
Sep 25, 2024
8774f30
rerun tests
Sep 25, 2024
31b97ad
updating test cases to check that tsql users have USAGE privilege on
Sep 26, 2024
2299ecf
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into performanc…
Sep 26, 2024
4738889
updating test cases for redundant USAGE privilge check on schema
Sep 27, 2024
7adf081
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV' into performanc…
Sep 27, 2024
19539b7
adding restricting for roles of the targetted db only
Sep 27, 2024
fe5ee6d
handling dump restore failure
Sep 27, 2024
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
3 changes: 3 additions & 0 deletions contrib/babelfishpg_common/sql/bit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -501,3 +501,6 @@ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

CREATE CAST (sys.VARCHAR AS sys.BIT)
WITH FUNCTION sys.varchar2bit(sys.VARCHAR) AS IMPLICIT;

CREATE CAST (bool AS sys.BIT)
WITHOUT FUNCTION AS IMPLICIT;
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ WITH FUNCTION sys.varchar2time(sys.VARCHAR, INT4) AS IMPLICIT;

CALL sys.babelfish_drop_deprecated_object('function', 'sys', 'varchar2time_deprecated_4_4_0');

-- bool bit cast
DO $$
DECLARE
sys_oid Oid;
pg_catalog_oid Oid;
bool_oid Oid;
bit_oid Oid;
BEGIN
sys_oid := (SELECT oid FROM pg_namespace WHERE pg_namespace.nspname ='sys');
pg_catalog_oid := (SELECT oid FROM pg_namespace WHERE pg_namespace.nspname ='pg_catalog');
bool_oid := (SELECT oid FROM pg_type WHERE pg_type.typname ='bool' AND pg_type.typnamespace = pg_catalog_oid);
bit_oid := (SELECT oid FROM pg_type WHERE pg_type.typname ='bit' AND pg_type.typnamespace = sys_oid);
IF (SELECT COUNT(*) FROM pg_cast WHERE pg_cast.castsource = bool_oid AND pg_cast.casttarget = bit_oid) = 0 THEN
CREATE CAST (bool AS sys.BIT)
WITHOUT FUNCTION AS IMPLICIT;
END IF;
END $$;

-- Drops the temporary procedure used by the upgrade script.
-- Please have this be one of the last statements executed in this upgrade script.
DROP PROCEDURE sys.babelfish_drop_deprecated_object(varchar, varchar, varchar);
Expand Down
5 changes: 1 addition & 4 deletions contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,6 @@ CAST(NULL AS varchar(254)) AS remarks
FROM pg_catalog.pg_class AS t1, sys.pg_namespace_ext AS t2, sys.schemas AS t3
WHERE t1.relnamespace = t3.schema_id AND t1.relnamespace = t2.oid AND t1.relkind IN ('r','p','v','m')
AND t1.relispartition = false
AND has_schema_privilege(t1.relnamespace, 'USAGE')
AND has_table_privilege(t1.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER');
GRANT SELECT ON sys.sp_tables_view TO PUBLIC;

Expand Down Expand Up @@ -1494,8 +1493,7 @@ LEFT JOIN sys.types AS t1 ON a.atttypid = t1.user_type_id
LEFT JOIN sys.sp_datatype_info_helper(2::smallint, false) AS t6 ON T.typname = t6.pg_type_name OR T.typname = t6.type_name --need in order to get accurate DATA_TYPE value
, sys.translate_pg_type_to_tsql(t1.user_type_id) AS tsql_type_name
, sys.translate_pg_type_to_tsql(t1.system_type_id) AS tsql_base_type_name
WHERE has_schema_privilege(s1.schema_id, 'USAGE')
AND X.indislive ;
WHERE X.indislive ;

GRANT SELECT ON sys.sp_special_columns_view TO PUBLIC;

Expand Down Expand Up @@ -1853,7 +1851,6 @@ FROM pg_catalog.pg_proc p

INNER JOIN sys.schemas s1 ON p.pronamespace = s1.schema_id
INNER JOIN sys.databases d ON d.database_id = sys.db_id()
WHERE has_schema_privilege(s1.schema_id, 'USAGE')

UNION

Expand Down
153 changes: 53 additions & 100 deletions contrib/babelfishpg_tsql/sql/sys_views.sql

Large diffs are not rendered by default.

Loading
Loading