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

Allow loading of specified databases only #5

Open
kgreiner-pcapps-com opened this issue Jun 9, 2017 · 4 comments
Open

Allow loading of specified databases only #5

kgreiner-pcapps-com opened this issue Jun 9, 2017 · 4 comments
Assignees

Comments

@kgreiner-pcapps-com
Copy link

I work on a server over a VPN that has about 50 databases, some of which have many tables and stored procedures. I only want to work in 2-3 of these databases. Loading this server takes more than 10 minutes, completely freezing SSMS. Sometime SHD glitches and doesn't load correctly.

As a proof-of-concept, I'm envisioning a list where each member contains a server name regex and a database name regex. If the server regex matches, load only those databases matched by the database regex. If this is useful, it could be extended to include another regex for schema name.

@csbubbles
Copy link
Contributor

Is it possible it happens because the add-in is trying to load all the metadata from that server right away? If that's the case, probably it's not the right behavior. I guess, the add-in should just load the list of databases first, and then either a) load the metadata for each of them only when you connect to some specific one, or b) proceed with getting all the information about tables / stored procedures for each database in background not blocking anything. Do you think this kind of behavior would fix the issue in your particular scenario?

@FastNinja
Copy link
Contributor

FastNinja commented Jun 10, 2017 via email

@csbubbles
Copy link
Contributor

@FastNinja

I might be missing something, but here goes the code...

  1. When a new server gets connected (or refreshed), it triggers OnServersAdded event:
    https://github.com/bugzinga/sql-hunting-dog/blob/master/HuntingDog/DogEngine/Impl/ServerWatcher.cs#L160
  2. Then for each server added the following event listener triggers DatabaseLoader initialization for each server:
    void _srvWatcher_OnServersAdded(List<IServerWithConnection> addedServers)
  3. Then DatabaseLoader triggers initialization for the bunch of meta fields (databases, tables, views, stored procedures, etc.):
    // these give you a HUGE perf win with SMO - it pre-fetches these, rather than having to make another call to SQL Server to get this value

I guess it actually triggers all the metadata load while a server gets connected / reconnected. And, while it's written in the comments that it is supposed to improve the performance, it might work the opposite way in the case Kevin has.

Please correct me if I am mistaken here...

@kgreiner-pcapps-com
Copy link
Author

My experience with slow loading leads me to think that all the metadata is loaded for the entire server. Yes, loading only from the selected database would be a great start. One problem is that rarely do I want the first database in the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants