Message-ID: From: "SophiahHo (@SophiahHo)" To: "pgjdbc/pgjdbc" Date: Tue, 11 Feb 2025 16:31:58 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3511: Performance Regression in JDBC Driver 42.7.5 - getCrossReference In-Reply-To: References: List-Id: X-GitHub-Author-Login: SophiahHo X-GitHub-Comment-Id: 2651349487 X-GitHub-Comment-Type: issue_comment X-GitHub-Edited-At: 2025-02-11T16:33:36Z X-GitHub-Issue: 3511 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3511#issuecomment-2651349487 Content-Type: text/plain; charset=utf-8 The slowness is caused by the where clause now checking that the catalog name matches the current database name: https://github.com/pgjdbc/pgjdbc/blob/6437a20cac2d544bee36e79082bdad0a34704585/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java#L2525 Previously, this check was omitted. A check is required to avoid incorrect behaviour. For example, in the old version, if there was a typo or inaccessible database for the `primaryCatalog` parameter, then getCrossReference would return results for the current database instead of empty results. If you're calling getCrossReference directly for the current database, you can set `primaryCatalog` (and `foreignCatalog`) to null, and the performance is similar to the old version.