Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f7626e

Browse files
committed
A couple of marginal performance hacks for the information_schema views:
replace the old recursive-SQL-function implementation of _pg_keysequal()with use of the built-in array containment operators, and changetable_constraints' UNION to UNION ALL. Per discussion with Octavio Alvarez.initdb not forced since this doesn't affect results, but you'd need toinitdb or reload the information_schema to see the new definitions.
1 parentca5646f commit3f7626e

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

‎src/backend/catalog/information_schema.sql

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.51 2009/02/06 21:15:11 tgl Exp $
7+
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.52 2009/02/14 20:48:36 tgl Exp $
88
*/
99

1010
/*
@@ -40,17 +40,9 @@ CREATE FUNCTION _pg_expandarray(IN anyarray, OUT x anyelement, OUT n int)
4040
pg_catalog.array_upper($1,1),
4141
1) as g(s)';
4242

43-
CREATEFUNCTION_pg_keyissubset(smallint[],smallint[]) RETURNSboolean
44-
LANGUAGE sql
45-
IMMUTABLE
46-
RETURNSNULLONNULL INPUT
47-
AS'select $1[1] is null or ($1[1] = any ($2) and coalesce(information_schema._pg_keyissubset($1[2:pg_catalog.array_upper($1,1)], $2), true))';
48-
4943
CREATEFUNCTION_pg_keysequal(smallint[],smallint[]) RETURNSboolean
50-
LANGUAGE sql
51-
IMMUTABLE
52-
RETURNSNULLONNULL INPUT
53-
AS'select information_schema._pg_keyissubset($1, $2) and information_schema._pg_keyissubset($2, $1)';
44+
LANGUAGE sql IMMUTABLE-- intentionally not STRICT, to allow inlining
45+
AS'select $1 <@ $2 and $2 <@ $1';
5446

5547
/* Get the OID of the unique index that an FK constraint depends on*/
5648
CREATEFUNCTION_pg_underlying_index(oid) RETURNSoid
@@ -1793,7 +1785,7 @@ CREATE VIEW table_constraints AS
17931785
OR has_table_privilege(r.oid,'INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER')
17941786
OR has_any_column_privilege(r.oid,'INSERT, UPDATE, REFERENCES') )
17951787

1796-
UNION
1788+
UNION ALL
17971789

17981790
-- not-null constraints
17991791

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp