Avoiding SQL's execution efficiency

zhaozj2021-02-11  224

Avoiding SQL's execution efficiency

Method 1, try to use complex SQL to replace simple SQL. The same transaction, a complex SQL completion efficiency is higher than the efficiency of simple SQL completion. When there are multiple queries, it is good at using Join. ORS = OCONN.EXECUTE ("Select * from books") While NOT ORS.EOF strsql = "select * from authors where authorid =" & ics ("authorid") ics2 = Oconn.execute (strsql) Response.write ORS ("Title ") &" >> "&" "" ") &"
& q UOT; ics.movenext () WEND is slower than the code below: strsql = "Select Books.title, Authors.Name from Books Join Authors ON Authors.authorid = books.authorid "Ors = Oconn.execute (strsql) While Not Ors.eof Response.Write Ors (" Title "&" >> "& ORS (" Name ") &"
& qua ot; ics .MOVENEXT () Wend method two, try to avoid using updatable recordsetors = Oconn.execute ("Select * from authors where authorid = 17", 3, 3) ics ("name") = "Darkman" ips.update () Slowly than the code: strsql = "Update Authors Set Name = 'Darkman' Where Authorid = 17" Oconn.execute strsql method three, when updating the database, try to use batch updates to make all SQL composition a large batch SQL, And run again; this is more efficient than one-way update data.

转载请注明原文地址:https://www.9cbs.com/read-3818.html

New Post(0)