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

[PG] TPGQuery.TableName optimization #249

Closed
arturm11 opened this issue Apr 25, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@arturm11
Copy link

commented Apr 25, 2018

Steps to reproduce this issue

  1. Connect to PostgreSQL database.
  2. Open Query window.
  3. SELECT * FROM anytable
  4. Click any "id" cell.

Current behavior

select * from person limit 5
;
SELECT 91039::regclass;
SELECT 91039::regclass;
/* Affected rows: 0 Found rows: 5 Warnings: 0 Duration for 1 query: 0,000 sec. (+ 0,093 sec. network) */
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;
SELECT 91039::regclass;

Expected behavior

Cache existing object names.

select * from person limit 5
;
SELECT 91039::regclass;
/* Affected rows: 0 Found rows: 5 Warnings: 0 Duration for 1 query: 0,000 sec. (+ 0,093 sec. network) */

Possible solution

Probably optimize TPGQuery.TableName function (not sure, there are 2 places, where regclass name is used in source code).

Environment

Windows 10

  • HeidiSQL version:

9.5.0.5264

  • Database system and version:

PostgreSQL 9.4.13

@ansgarbecker

This comment has been minimized.

Copy link
Collaborator

commented May 18, 2019

I am now caching these SELECT 123::regclass query results in a hash table, so they're fired only once in the lifetime of a connection. This also fixed issue #538 for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.