LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple simultaneous access to DB With Labview

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.

 

 

 

 

image.png

Download All
0 Kudos
Message 1 of 4
(3,405 Views)

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.

0 Kudos
Message 2 of 4
(3,367 Views)

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 ? 

0 Kudos
Message 3 of 4
(3,339 Views)

Reading and writing to the same table in parallel operations = potential Race Condition

0 Kudos
Message 4 of 4
(3,335 Views)