Home > front end > Questions about ASP query efficiency
Questions about ASP query efficiency
Time:10-23
A database, resource quantity 240000,
Basically, customer resource storage content in table 1: name, phone, add, add time User information table 2 with 30 users information,
Do not regularly every day each user statistics, there are so many customers, The current methods: Strquery="select the name from o_user order by id asc" Set the rs=conn. Execute (strquery) If not rs. Bof then Eof the do while not rs.% & gt; User: & lt; %=rs (" name ") % & gt; Customer number: & lt; Call the get %=rs (" name ") % & gt;
<% Rs. Movenext Loop % & gt;
Customer number code is as follows: statistical user name because is 8 o 'clock to work every day, so is statistical data after 07:00:00, d is the date of the day, for example: 2020-10-11 <% Sub getnum (user, d) Dim objRSa The Set objRSa=Conn. Execute (" SELECT COUNT (id) FROM o_connection WHERE addtime & gt; '" & amp; D&" 07:00:00 'and adduser=' "& amp; Trim (user) & amp;" ' ")If Not objRSa. (bof) And Then Not objRSa. (eof) CommNums=objRSa (0) End the If The Set objRSa=Nothing Response. Write CommNums End Sub % & gt;
Above ways can run normally, can also be the accurate data, but the execution is slow, each time to refresh at least 30 to 40 seconds is as a result, the high efficient way please?
CodePudding user response:
The Set objRSa=Conn. Execute (" SELECT adduser, COUNT (id) FROM o_connection WHERE addtime & gt; '" & amp; D&" 07:00:00 'group by adduser ") While Not objRSa. Eof Response. Write "user:" & amp; ObjRSa (0) & amp;" Customer: "& amp; ObjRSa (1) & amp;" " ObjRSa. MoveNext Wend