forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically run ANALYZE after babelfish extension create/upgrade (b…
…abelfish-for-postgresql#1922) Earlier, when having less than 50 schemas on the fresh instance causes the poor performance for problematic query when having large number of objects in database. In case of less than 50 schemas, sys.babelfish_namespace_ext catalog which stores the name of schema will have less than 50 rows which means autovacuum ANALYZE has never been run by PostgreSQL autovacuum daemon as the number of inserted rows doesn't exceeds the threshold criteria. Since the sys.babelfish_namespace_ext catalog has never been analyzed it leads bad query planning for large query. This commit add changes to automatically run ANALYZE after babelfish extension create/upgrade for all babelfish catalogs to avoid such issues in future. Issues Resolved Task: BABEL-4487 Signed-off-by: Sumit Jaiswal [email protected]
- Loading branch information
Showing
25 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
test/JDBC/expected/AUTO_ANALYZE-before-15-5-or-14-10-vu-prepare.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
-- list all the babel catalogs that has been analyzed manually during extension create | ||
-- will return NULL in this case | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NOT NULL order by relname | ||
Go | ||
~~START~~ | ||
varchar | ||
~~END~~ | ||
|
9 changes: 9 additions & 0 deletions
9
test/JDBC/expected/AUTO_ANALYZE-before-15-5-or-14-10-vu-verify.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
-- list all the babel catalogs that has not been analyzed manually during extension upgrade | ||
-- will return NULL in this case | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NULL order by relname | ||
GO | ||
~~START~~ | ||
varchar | ||
~~END~~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
-- list all the babel catalogs that has not been analyzed manually during extension create | ||
-- will return NULL in this case | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NULL order by relname | ||
Go | ||
~~START~~ | ||
varchar | ||
~~END~~ | ||
|
||
|
||
-- list all the babel catalogs that has been analyzed manually during extension create | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NOT NULL order by relname | ||
Go | ||
~~START~~ | ||
varchar | ||
assemblies | ||
babelfish_authid_login_ext | ||
babelfish_authid_user_ext | ||
babelfish_configurations | ||
babelfish_domain_mapping | ||
babelfish_extended_properties | ||
babelfish_function_ext | ||
babelfish_helpcollation | ||
babelfish_namespace_ext | ||
babelfish_schema_permissions | ||
babelfish_server_options | ||
babelfish_sysdatabases | ||
babelfish_syslanguages | ||
babelfish_view_def | ||
service_settings | ||
spt_datatype_info_table | ||
versions | ||
~~END~~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
-- list all the babel catalogs that has not been analyzed manually during extension upgrade | ||
-- will return NULL in this case | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NULL order by relname | ||
GO | ||
~~START~~ | ||
varchar | ||
~~END~~ | ||
|
5 changes: 5 additions & 0 deletions
5
test/JDBC/input/AUTO_ANALYZE-before-15-5-or-14-10-vu-prepare.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
-- list all the babel catalogs that has been analyzed manually during extension create | ||
-- will return NULL in this case | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NOT NULL order by relname | ||
Go |
5 changes: 5 additions & 0 deletions
5
test/JDBC/input/AUTO_ANALYZE-before-15-5-or-14-10-vu-verify.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
-- list all the babel catalogs that has not been analyzed manually during extension upgrade | ||
-- will return NULL in this case | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NULL order by relname | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
-- list all the babel catalogs that has not been analyzed manually during extension create | ||
-- will return NULL in this case | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NULL order by relname | ||
Go | ||
|
||
-- list all the babel catalogs that has been analyzed manually during extension create | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NOT NULL order by relname | ||
Go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
-- list all the babel catalogs that has not been analyzed manually during extension upgrade | ||
-- will return NULL in this case | ||
SELECT relname FROM pg_stat_all_tables WHERE schemaname = 'sys' and last_analyze IS NULL order by relname | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,3 +313,4 @@ BABEL-3215 | |
orderby-before-14_8-or-15_3 | ||
getdate | ||
BABEL-4410 | ||
AUTO_ANALYZE-before-15-5-or-14-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,3 +313,4 @@ BABEL-3215 | |
orderby-before-14_8-or-15_3 | ||
getdate | ||
BABEL-4410 | ||
AUTO_ANALYZE-before-15-5-or-14-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,3 +313,4 @@ BABEL-3215 | |
orderby-before-14_8-or-15_3 | ||
getdate | ||
BABEL-4410 | ||
AUTO_ANALYZE-before-15-5-or-14-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -326,3 +326,4 @@ BABEL-3215 | |
orderby-before-14_8-or-15_3 | ||
BABEL_4330 | ||
BABEL-4410 | ||
AUTO_ANALYZE-before-15-5-or-14-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -338,3 +338,4 @@ orderby-before-14_8-or-15_3 | |
getdate | ||
BABEL_4330 | ||
BABEL-4410 | ||
AUTO_ANALYZE-before-15-5-or-14-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -364,3 +364,4 @@ BABEL-3215 | |
orderby-before-14_8-or-15_3 | ||
getdate | ||
BABEL_4330 | ||
AUTO_ANALYZE-before-15-5-or-14-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -406,3 +406,4 @@ BABEL-3215 | |
orderby | ||
getdate | ||
BABEL_4330 | ||
AUTO_ANALYZE-before-15-5-or-14-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -406,3 +406,4 @@ BABEL-3215 | |
orderby | ||
getdate | ||
BABEL_4330 | ||
AUTO_ANALYZE-before-15-5-or-14-10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters