Refreshing tree can issue a very long list of queries

lemon_juice's profile image lemon_juice posted 14 years ago in General Permalink
I have noticed that refreshing the left object tree unnecessarily queries the server about databases that I have looked at before but now are hidden (collapsed). For example, I open a connection, expand database A, then B, then C, then I'm not interested in B and C anymore so I collapse them and I'm looking at tables from database A. Now when I press the refresh button Heidi queries for information about A, B, and C even though B and C are hidden. This can lead to a long list of queries that take time and decrease performance. For example, this can happen when only table6 is expanded:

SHOW TABLE STATUS FROM `table1`;
SHOW FUNCTION STATUS WHERE `Db`='table1';
SHOW PROCEDURE STATUS WHERE `Db`='table1';
SHOW TRIGGERS FROM `table1`;
SHOW TABLE STATUS FROM `table2`;
SHOW FUNCTION STATUS WHERE `Db`='table2';
SHOW PROCEDURE STATUS WHERE `Db`='table2';
SHOW TRIGGERS FROM `table2`;
SHOW TABLE STATUS FROM `table3`;
SHOW FUNCTION STATUS WHERE `Db`='table3';
SHOW PROCEDURE STATUS WHERE `Db`='table3';
SHOW TRIGGERS FROM `table3`;
SHOW TABLE STATUS FROM `table4`;
SHOW FUNCTION STATUS WHERE `Db`='table4';
SHOW PROCEDURE STATUS WHERE `Db`='table4';
SHOW TRIGGERS FROM `table4`;
SHOW TABLE STATUS FROM `table5`;
SHOW FUNCTION STATUS WHERE `Db`='table5';
SHOW PROCEDURE STATUS WHERE `Db`='table5';
SHOW TRIGGERS FROM `table5`;
SHOW TABLE STATUS FROM `table6`;
SHOW FUNCTION STATUS WHERE `Db`='table6';
SHOW PROCEDURE STATUS WHERE `Db`='table6';
SHOW TRIGGERS FROM `table6`;
SHOW TABLE STATUS FROM `table7`;
SHOW FUNCTION STATUS WHERE `Db`='table7';
SHOW PROCEDURE STATUS WHERE `Db`='table7';
SHOW TRIGGERS FROM `table7`;
SHOW DATABASES;
SHOW CREATE TABLE `table6`.`blog`;

Is this behaviour intentional? I would certainly prefer that only the currently expanded databases be queried. A workaround is to open a new window with the same connection and close the old one to clear the list of remembered databases, but that is a hassle. What do you think?
lemon_juice's profile image lemon_juice posted 14 years ago Permalink
Sorry, I made a mistake that could make my point less clear: the example database names should be database1, database2, etc. and not table1, table2... of course!
ansgar's profile image ansgar posted 14 years ago Permalink
Well that is intentionally, but feels like that was not so well tested on situations where you have many databases opened. So I guess you're right - only the current db should get refetched, other expanded ones should get collapsed.
lemon_juice's profile image lemon_juice posted 14 years ago Permalink
I think databases shouldn't get collapsed when I do a refresh, I would expect the view to stay unchanged - only refreshed. And it's fine for me when multiple databases are refetched as long as they are expanded. It's just that I don't want Heidi to refetch databases that are collapsed.
Code modification/commit e43d115 from ansgar.becker, 14 years ago, revision 6.0.0.3762
Update cached objects only for current and expanded database nodes when refreshing. No need to do that also for all previously selected databases. See http://www.heidisql.com/forum.php?t=6773
ansgar's profile image ansgar posted 14 years ago Permalink
Done in r3762 - tested and works for me. Please report back if that's working for you. I have a slight feeling I just introduced new access violations in the tree but I may only be afraid because there were so many in the past.
lemon_juice's profile image lemon_juice posted 14 years ago Permalink
Thanks, it's working very well from what I can see. No crashes so far but I'll report if there are any.

There's only one small glitch, I don't know if it's related to refreshing - very often when I click on table names in the tree they don't get fully selected - the highlight colour is different (looks like disabled or unfocused item highlight) and the refresh button doesn't work. I have to wait a second and click again, then the table becomes fully selected and the refresh button works.
ansgar's profile image ansgar posted 14 years ago Permalink
Think you mean "unfocused" when you say "disabled". That's very normal as when you click a table your focus gets immediately moved to the table editor's "Name" input box. Just watch if that has focus.
lemon_juice's profile image lemon_juice posted 14 years ago Permalink
Yes, it becomes unfocused and the focus goes to the name input box. So it looks like intentional behaviour? It's a bit weird to me that the focus goes away to a place I didn't click on. But it's a small issue for me so I don't mind it so much.

BTW, where are the older forum posts? I can see only one page of posts without any navigation to older pages.
ansgar's profile image ansgar posted 14 years ago Permalink
Older posts are only searchable, not browsable heresmileMy forum is homebrown and minimalistic. But most old posts can be found via Google.

The stealing focus thing was a feature request, see issue #2289. Feel free to leave a comment there.
lemon_juice's profile image lemon_juice posted 14 years ago Permalink
Okay, I see.

The stealing focus request described there seems very reasonable to me but I think it shouldn't have been implemented for existing tables. I left my comment in the tracker.

Please login to leave a reply, or register at first.