LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DBActivateMap guetting slower and slower

Solved!
Go to solution
Hello,

I'm using (it means that I'm not the developer of this script) a Labwindows/CVI 8.0 scritp to characterize devices electrically and to store the data of each acquisition in a MySQL database.
There are 20 devices sequentially characterized and ideally it takes 2 seconds to measure and to store the data.
But when the table becomes bigger, the time between 2 acquisitions gets longer. At the moment, the cycle lasts 8 seconds (instead of 2 seconds when the table is empty).

I tried to looked at the script and it seems that the problem comes from the commande DBActivateMap which is executed before each acquisition.
I don't know exactly the role of this command and I don't know if it necessary to launch it at each cycle.
I can imagine that if the developer put in in the script, it is necessary.
But is there a way to improve the speed of this command ?

I thank you in advance for your help,
Have a nice week,
Ptit Bleu.
0 Kudos
Message 1 of 17
(5,430 Views)
Hi,

I suppose the developper used DBConnect API ?!

I'm not able to see this function in the API, so I think it is a function declared by the developper of your application.

If so, we can't help you without knowing the purpose of that function.

More details about your function would be appreciated




Message Edité par NI_Device_user_sb le 07-21-2008 03:51 AM
0 Kudos
Message 2 of 17
(5,424 Views)

Hello again,

If it can help, I found a pdf document http://www.ni.com/pdf/manuals/320960a.pdf describing the DBActivateMap (page 35 / 99).
But unfortunately, my skills in computer and my english level are too low ...
Does somebody can tell me why this command gets slower when the table gets bigger (is it normal ?) ?

Thanks again for your help,
Ptit Bleu.

0 Kudos
Message 3 of 17
(5,417 Views)
As far as I understand,

DBActivateMap is used to allow you to perform operations on tables (retireving or putting datas) as you can see on Fig 3-1 page 21

As you said, if you call DBActivateMap for each acquisition, it means that you connect and disconnect to database 20 times and maybe that's  why you're having troubles.(That's just what I think and I'm not sure cause I never used those functions)

Maybe you can inform us about your database architecture?


Message Edité par NI_Device_user_sb le 07-21-2008 06:19 AM
0 Kudos
Message 4 of 17
(5,408 Views)
Hi,

im working as newbe on a sql project and because i had some trouble i asked
NI (see also my request "SQL Fetch Data - Data get not updated). So now i
know, that you have to call DBActivateMap every time. At the end of your
data acquisition you also should call DBDeactivateMap(db_mapHandle), may be
you have to check if DBActivateMap is called!

Greetings from Bremerhaven, Germany

Norbert Rieper


"NI_Device_user_sb" <x@no.email> schrieb im Newsbeitrag
news:1216640408095-747761@exchange.ni.com...
> As far as I understand,DBActivateMap is used to allow you to perform
> operations on tables (retireving or putting datas) as you can see on Fig
> 3-1 page 21As you said, if you call DBActivateMap for each acquisition, it
> means that you connect and disconnect to database 20 times and maybe
> that's&nbsp; why you're having troubles.(That's just what I think and I'm
> not sure cause I never used those functions)Maybe you can inform us about
> your database architecture?Message Edité par NI_Device_user_sb le
> 07-21-2008 06:19 AM


0 Kudos
Message 5 of 17
(5,402 Views)

Hello again,

The table Table1 has 30 colums (as double or as float and one as strings to store the date+time of the acquisition).
The script adds 1 row per acquisition (ideally 1 acquisition every 2 seconds during 1 minute then it stops during 5 minutes, 24/24).
It means that the number of rows increases quite rapidly but I think it is not so big.

I can understand that DBActivateMap is necessary each time but I don't understand why its execution time is getting bigger as the size of the table increases.

Here is a part of the script. I'm not sure it will help you to help me, but who knows ...
The command whose execution time is getting bigger is the first line :
statementHandle = DBActivateMap (mapHandle, "Table1");

Thanks again for your advices,
Ptit Bleu.

------------------------------------------------------------------------------------------------------------------------

// Activate the link with the variables (my translation of the comments of the developer)
statementHandle = DBActivateMap (mapHandle, "Table1");
if (statementHandle < 0 )
{
sprintf ( errMessage, " Error Activating Database");
return 1;
}

// Create the record
resCode = DBCreateRecord (statementHandle);
if (resCode != DB_SUCCESS)
{
sprintf ( errMessage, " Error Creating Record Datadase");
return 1;
}

// Insert the data into the database
resCode = DBPutRecord (statementHandle);
if (resCode != DB_SUCCESS)
{
sprintf ( errMessage, " Error Putting Record Datadase");
return 1;
}

// Deactivate the links with variables
resCode = DBDeactivateMap(mapHandle);
---------------------------------------------------------------------------------------------

0 Kudos
Message 6 of 17
(5,385 Views)

Hello,

I don't think it's a problem with LabWindows/CVI, the database provider may be slower with a bigger database. I'm looking for informations about that and I'll keep you in touch if I find something.

Have a nice day,

0 Kudos
Message 7 of 17
(5,359 Views)
Thanks for your message Maxime,

In my opinion (newbie's one) if the role of DBActivateMap is  to  allow  the  modification of the table with sql commands such as insert, update, ... it only needs the architecture of the table. Then, the time needed to get these informations should be independent of the size of the table (???).

I'm wating for your answer,
Have a nice week-end,
Ptit Bleu.

0 Kudos
Message 8 of 17
(5,340 Views)

Hello,

Just a small message to ask M. Muller if he found a solution to my problem (I still have it ...).

 

Thanks in advance,

Best regards,

Ptit Bleu.

0 Kudos
Message 9 of 17
(5,010 Views)

Hi,

 

I don't understand something, your CVI just creat a new row in the database?

 

DBActivateMap do a automatic "select" on the database, if you dont't use DBMapColumnTo* before, this request create SQL request that select ALL THE DATABASE, it's can be very slow if you have a lot of entries.

 

If you create a row, you don't need to have a previous rows, use  resCode = DBImmediateSQL (mapHandle, “INSERT INTO Table1 VALUES (var1,var2,var3,var4)");

 

Best regards,

0 Kudos
Message 10 of 17
(4,992 Views)