Home > Back-end >  Delphi7 query SQL Server2008 efficiency problem
Delphi7 query SQL Server2008 efficiency problem

Time:09-16

Recently wrote a program about sql2008 data query, which encountered a few problems, do not know how to start, a great god, please give directions
I'm through TADOConnection component with SQL Server, through the TADOQuery component data access, write SQL query language, database table is very simple, only one table, the table has ID, timestamp, and more than 20 strings, each not more than 10 characters, there are about 15 g database, the database tables is not my, and has been used cannot be changed,
My goal is to remove abnormal changes in the database data, and then judge the abnormal changes of what belongs to
Every time I currently take out 1 w data (dare not to add the query conditions, because the abnormal changes of data is not regular, sometimes a check is ages), then through the algorithm I wrote a quick judgment,
Problem:
Article 1, a single query 1 w data only it takes about 140 milliseconds, but when continuous take (also known as access - algorithm when the judge - access - algorithm to judge) several times after the access time becomes 2-3 seconds, don't know what reason, I am by ID query,
Feign death, when I was 2, the query Internet along while, it should start another thread for (I am now writing in the timer control), haven't tried don't know can't solve,
Is there a more efficient way to query?
3, the execution time of the algorithm is a little long, and every CPU utilization from 50% to 80%, don't know why, I'm from inside the TADOQuery read a is a, then next again next, checked the, it should be placed in an array, haven't tried, don't know is for this reason, the
Above is I encountered several problems, please supervise your great god help me to answer it,

CodePudding user response:

The change of the data sheet if you need very high efficiency, better real-time requirements, generally should not be set in the program, in the database are suggested to create a stored procedure, using the data update trigger event notification program

Use your algorithm, I am a database administrator, I'll direct your IP DROP the

CodePudding user response:

Database is not updated, it is already recorded data, and database I don't have permission to change the==,

CodePudding user response:

reference 1st floor doloopcn response:
the change of the data sheet if you need very high efficiency, better real-time requirements, generally should not be set in the program, in the database are suggested to create a stored procedure, using the data update trigger event notification program

Use your algorithm, I am a database administrator, I'll direct your IP DROP the

Database is not updated, it is already recorded data, and database I don't have permission to change the==,

CodePudding user response:

It is recommended to use a special stored procedure to complete the matter!

CodePudding user response:

You have a buffer queue, such as put out a data in the cache to cache the data processing in the finish to read the database

CodePudding user response:

reference 4 floor liups response:
it is recommended to use a special stored procedure to complete the matter!

Requirements of the building Lord and I met a similar problem before: there is a commercial version of the business software, need some statistics on its data, obviously can not change the original data, the solution: a stored procedure to statistics in SQL server, so will not have any effect on the original function, and efficiency is absolutely no problem,

CodePudding user response:

Big data browsing, there is no shortcut, access to the field of as little as possible (fast),

CodePudding user response:

Guide to their own database, you can do what want to, hey hey

CodePudding user response:

1. The shielding his algorithm, cycle number, only to determine where the card
2. If the card in his algorithm, the timer began to join the timer. Enabled:=false; End to join the timer. Enabled:=true;

CodePudding user response:

Suggest that export data to your own library, agree with above analysis

CodePudding user response:

1. If you are not afraid to affect others to use the database query data, a select command all can get the results you need to, don't need to write what Delphi procedure, judge whether a record abnormal you anyway is a judgment conditions,
2. If must be written in Delphi programs to determine, first to confirm whether the server is slow or program slowly, executing the program to the server SQL commands directly, if you do not see any slower, it shows that is not a server problem but program,
3. If the program problem, suggest using sdac try, don't use ado, many other people in this BBS inside use ado, bde such antiques, really confusing,
  • Related