I wrote a simple message book with SQL Server and ASP. I found in constant attempts that when the paging shows the message, different execution methods and time differences. This site contains this article ASP calling MSSQL storage procedures for two methods and efficiency speed. In detail, explain in detail the related MSSQL storage process paging efficiency speed technology and knowledge. Welcome to give you some support and help in this area! The following is the details:
Beerfroth (original)
I wrote a simple message book with SQL Server and ASP. I found in constant attempts that when the paging shows the message, different execution methods and time differences.
Let ’s take a look at the time comparison of several methods by comparison.
First, use the storage procedure paging, this situation is divided into two ways:
The first, using the Command object, as follows:
Set cmd = server.createObject (Adodb.Command)
CMD.ActiveConnection = CONN
Cmd.commandtext = ycuu_gb_getmsg
Cmd.commandtype = 4'ADCMDSTOREDPROC
cmd.prepared = true '
set param = cmd.createparameter (@ipageno, adinteger, 1,2, page)
Cmd.parameters.appending param
set param = cmd.createparameter (@ipageSize, adinteger, 1,2, pageSizeConst)
Cmd.parameters.appending param
set rs = cmd.execute
The second is to execute the execution method of the Connection object directly, as follows:
set rs = const.execute (execute ycuu_gb_getmsg & page &, & pageSizeConst)
Second, do not use the storage procedure, directly use the function of adodb.recordset to page. The specific code is as follows:
Set rs = server.createObject (Adodb.oldSet)
SQL = SELECT * from Guestbook Order by Dateandtime Desc
RS.Oopen SQL, CONN, 1,1
RS.PAGESIZE = 150 'The number of messages displayed on each page,
Total = RS.RCORDCOUNT
mypageSize = RS.PAGESIZE
rs.absolutePage = page
In order to display the speed more obvious, I increased the number of messages displayed per page to 150 (in fact, of course, it will not set such a large value). As for the configuration of my machine, it is omitted, because it is mainly speed comparison.
Discovery, the time when execution is as follows:
The first: stable between 0.1953125 seconds and 0.2109375 seconds, the average value is about 0.20 seconds
The second: stable between 0.1716875 seconds and 0.1857 seconds, the average value is about 0.177 seconds
The third type: between 0.4375 seconds and 0.4632 seconds, the average value is about 0.45 seconds
However, when the number of records read is 20, the result is as follows:
Discovery, the time when execution is as follows:
The first: stable between .0390625 seconds and .0546875 seconds, the average value was about: 0.045 seconds
The second: stable between 0.046875 seconds and .0546875 seconds, the average value is about 0.050 seconds
Third: stable between .09375 seconds and 0.1015625 seconds, the average value is about: 0.97 seconds
In this perspective, it seems that the two methods of connected and commit.execute seem to be not much different.
The former calling method seems to be more simple.
At the same time, it can be seen here that the storage speed of the paging is indeed much faster than the paging speed of RecordSet.
PS: The younger brother posted the first article, oh, it was really difficult to find a good article, I will work hard in the future. I hope everyone will not write well this time. By the way, I also want to ask all the better ways of the hero Conn.execute and Command.execute, haha, because what I found on the Internet performs storage procedures in this way. I don't know why it doesn't need to be as simple as the front.
ASP calls the two methods and efficiency speed of the MSSQL storage procedure for paging the article. The article is here. Welcome to browse other content of this site, click here to return to the homepage