issus / altium-library

Open source Altium Database Library with over 200,000 high quality components and full 3d models.
https://altiumlibrary.com
1.88k stars 866 forks source link

SQL Remote Queries inefficiencies #45

Closed tomas1808 closed 4 years ago

tomas1808 commented 4 years ago

First I want to say thanks for this project. I can't wait to see the library grow bigger and bigger.

Now to the problem:

I noticed that sometimes when selecting components it would get stuck for about a minute before I could place the component. I just checked the packet activity using Wireshark and noticed that when selecting a specific component I got about 215 requests to 51.89.172.95 which I presume is the SQL database server. This particular case took 45 seconds. I am in Uruguay, so the latency really adds up.

image

Upon further inspection, it looks like when selecting a component in a specific library a remote query is made for each of the tables until it matches the containing table of that component. This means that components located in the first libraries work perfectly but those located on the latter libraries take a long time. Here are some of the SELECT queries, each a separate request:

Select [Footprint Ref], [Footprint Path] From [Amplifiers - Audio] Where [Footprint Ref] = 'CAP FILM 0805'

Select [Footprint Ref 2], [Footprint Path 2] From [Amplifiers - Audio] Where [Footprint Ref 2] = 'CAP FILM 0805'

Select [Footprint Ref 3], [Footprint Path 3] From [Amplifiers - Audio] Where [Footprint Ref 3] = 'CAP FILM 0805'

Select [Footprint Ref], [Footprint Path] From [Amplifiers - OP Amps and Buffer Amps] Where [Footprint Ref] = 'CAP FILM 0805'

Select [Footprint Ref 2], [Footprint Path 2] From [Amplifiers - OP Amps and Buffer Amps] Where [Footprint Ref 2] = 'CAP FILM 0805'

... and so on until it matches the component

This seems awfully inefficient. I'd suspect there should be only a single SQL request to the right table right away. Is this back and forth necessary? To make things worse this chain of requests is made even when placing repeated instances of the same object, which makes no sense.

I am not sure if this is an Altium shortcoming or something that can be fixed on your side (maybe have a single table/library with all the components?)

Any ideas?

Thanks!

issus commented 4 years ago

We have no control over this at all, this is all Altium.

Please make a report in BugCrunch instead: https://bugcrunch.live.altium.com/