mysql 查詢優(yōu)化原理,ASP+mysql海量數(shù)據(jù)的分頁優(yōu)化?
要把connection設置為使用本地游標定位方式,mysql的server端不支持recordset的recordcount屬性。connstr="****
"set conn=server.createibject("ADODB.Connection"
)conn.Open connstrconn.CursorLocation=3 'adUseClient=3,而默認為adUseServer(=2)set rs=server.createobject("ADODB.recordset"
)sql="select ....."rs.open sql,conn,1,1'這時候就可以用recordcount pagecount了rs.pagesize=10rs.absolutepage=cint(strpage)select_count=rs.recordcountselect_pagecount=rs.pagecount