Avoiding SQL's execution efficiency

zhaozj2021-02-16  87

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 a pile of simple SQL. 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 ") &" >> "& ors2 (" name ") 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") ics.movenext () Wend

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

New Post(0)