03-16-2018 12:51 PM
Hi,
I wanted to use the Database toolkit from Labview to access (Read and Write) in a database. I use MySQL and ODBC. This is the first time that I used DB so I am not a specialist and it may be something quiet simple that I missed.
When my database start to growth a little bit, writing and reading at the same time causes a significant delay in the Write function (even if I used the Tansaction isolation level Read = Uncommitted). For my application writing to this DB is critical process. As soon as the time table growth a little bit (about 1 000 000 points) the delay is quiet long (up to few seconds).
I also tried to open 2 different sessions of MySQL servers (with 2 different domains in ODBC) but I also observed the same delay.
I thought that DB was able to handle several connections at the same time and that the "INSERT" would not be affected by some simultaneous "SELECT" at least when the look table is disable.
Is there something I missed in the configuration of the DB ? Is it possible to prioritize the INSERT function ?
I include the (dirty) TestDB.vi that have two parallels loops, one for reading from the DB and one for Inserting data. As you may see from the Screen shot, when the "Select" Loop is disabled, the time for the INSERT Loop execution takes few ms. But when the Select loop is on, it goes up to 300 ms (with 100 000 points).
Thank's a lot in advance.
Benoît.
03-17-2018 11:26 AM
edit : I also tried to write and read in two different tables (but still in the same DB) so i don't think that it's a table lock issue.
03-19-2018 08:58 AM
Actually I found the solution and it is (as every bug) very simple. The VI "DB Tools Execute Query" have non-reentrance execution. By changing the properties of this VI, the problem was solved. I do not really understood why this VI have no-reetrant execution by default in the toolkit. Is there any reason for it ?
03-19-2018 10:17 AM
Reading and writing to the same table in parallel operations = potential Race Condition