This is an automated email from the ASF dual-hosted git repository. struberg pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openjpa.git
commit f92c85314dc55c780378519c5ca6e20c8deb76e3 Author: Mark Struberg <[email protected]> AuthorDate: Mon Aug 31 15:02:23 2020 +0200 OPENJPA-2795 add documentation and PostgreSQL support Postgres also doesn't automatically create a foreign key index. --- .../apache/openjpa/jdbc/sql/PostgresDictionary.java | 2 ++ .../src/doc/manual/ref_guide_dbsetup.xml | 21 +++++++++++++++++++++ .../src/doc/manual/ref_guide_mapping.xml | 7 +++++++ 3 files changed, 30 insertions(+) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java index 935a924..644442a 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java @@ -209,6 +209,8 @@ public class PostgresDictionary extends DBDictionary { _timestampTypes.add("ABSTIME"); _timestampTypes.add("TIMESTAMP"); _timestampTypes.add(timestampTypeName.toUpperCase(Locale.ENGLISH)); // handle user configured timestamp types. + + indexPhysicalForeignKeys = true; // PostgreSQL does not automatically create an index for a foreign key so we will } @Override diff --git a/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml b/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml index c839c87..7024116 100644 --- a/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml +++ b/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml @@ -1810,6 +1810,27 @@ works around cases where the limit is exceeded. Defaults to -1 meaning no limit. </para> </listitem> + + <listitem id="DBDictionary.IndexPhysicalForeignKeys"> + <para> + <indexterm> + <primary> + DDL + </primary> + <secondary> + IndexPhysicalForeignKeys + </secondary> + </indexterm> + <literal>IndexPhysicalForeignKeys</literal>: + Whether a search Index should automatically get created on a physical foreign key. + Some databases, like MySQL, handle this internally, so we do not need to generate + an explicit Index in our DDL. Other databases need an explicit serach index + on foreign key columns to improve performance. + + IndexPhysicalForeignKeys defaults to true for Oracle, MS-SQL and PostgreSQL. + </para> + </listitem> + <listitem id="DBDictionary.InitializationSQL"> <para> <indexterm> diff --git a/openjpa-project/src/doc/manual/ref_guide_mapping.xml b/openjpa-project/src/doc/manual/ref_guide_mapping.xml index 9a2c1d7..a998102 100644 --- a/openjpa-project/src/doc/manual/ref_guide_mapping.xml +++ b/openjpa-project/src/doc/manual/ref_guide_mapping.xml @@ -1186,6 +1186,13 @@ database foreign key. Defaults to true. </listitem> <listitem> <para> +<literal>IndexPhysicalForeignKeys</literal>: Boolean property controlling +whether to create explicit indexes on real physical foreign keys. +The default value will be taken from the corresponding <literal>DBDictionary</literal> attribute. + </para> + </listitem> + <listitem> + <para> <literal>DataStoreIdColumnName</literal>: The default name of datastore identity columns. </para>
