10-28-2019 09:24 AM
Hello I have a fairly large LV2015 application that reads many times (>100) from database. So far I have used a vi with open-execute-fetch-close for each mysql query.
I have spent some time to make the slowest mysql queries faster, using the mysql profiling.
But when I now finally profile in labview (by saving exact times to an event file) I see that each open (DB tools open connection.vi) seems to take about 300ms. If I then have 100 queries this really adds up to a lot of time...
So what is best practice here, shall I have one open connection all the time, assuming it stays open for ever (a user might work 2-3h at a time with the program).
Another idea is to do some kind of check if the connection is still open, before each query, and only open if not.
A third is to assume is stays open, and redo the query with Open if I get error messages.
I guess you guys have some good advice here!
I might add that the database has moved from within the same office to another office, making the problem worse.
Labview 2015, mariadb 10.1
10-28-2019 09:38 AM
You already figured out. My preferred is the third option, however the second is not much different.
10-28-2019 10:37 AM
@pincpanter wrote:
You already figured out. My preferred is the third option, however the second is not much different.
Ditto that!
Add "possible memory leak" from repeatedly opening and closing a resource (that will only show up in the Task Manager since the DB is outside the LV context).
Ben