pgAdmin 4 commit: Add an optimisation to the internal code responsible - Mailing list pgadmin-hackers

From Dave Page
Subject pgAdmin 4 commit: Add an optimisation to the internal code responsible
Date
Msg-id E1huz7E-0000FJ-Pq@gothos.postgresql.org
Whole thread Raw
List pgadmin-hackers
Add an optimisation to the internal code responsible for searching for treeview nodes. Fixes #4570

Attached is a tiny but very effective patch to improve the speed of
finding a node using path (used internally).
If you right click or just click on a node, internally the node is
traversed using its path. But currently, it compares with the path of
all the open nodes to find a match.
So if you 1000+ tables and the tables node is open and if you click on
a view, the view path is compared with all the 1000+ tables (and with
any other open nodes above) before arriving to path. You're at bad luck
if you have more open servers above.

Code is changed to check if the path of node to be found starts with the
current node path. If it doesn't match, why bother the children's of
current node.
This change will not show much effect for small data, but it does matter
for large servers.

One more change is to remove unnecessary calls to find node and use the
data available with Main Menu -> Object to enable/disable node context
menu items.

Branch
------
master

Details
-------
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=6800b1f7234ebce329f5603859c1b995a767bd55
Author: Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>

Modified Files
--------------
docs/en_US/release_notes_4_12.rst     | 1 +
web/pgadmin/browser/static/js/menu.js | 7 ++++++-
web/pgadmin/static/js/tree/tree.js    | 9 +++++++++
3 files changed, 16 insertions(+), 1 deletion(-)


pgadmin-hackers by date:

Previous
From: Aditya Toshniwal
Date:
Subject: [pgAdmin][RM4554] RE-SQL for trigger functions
Next
From: Dave Page
Date:
Subject: Re: [pgAdmin][RM4570] Tree improvement to improve speed of finding a node