If GUID is not a key in the database make it one. That way you won't have to do serial reads through the entire table to locate matching entries.
It is hard to be more specific because we don't know how many records are in ASPSessionState table. If there are only a few, the problem is probably elsewhere. If there are many, indexing on GUID would provide speed improvement. Larry Bates bart wrote: > I run a python website on a IIS server. I replaced my flat file DB > with SQL server, but the reads are very slow. 7 seconds for 3 querrys > like these > > conn= adodbapi.connect( "Provider=SQLOLEDB.1;Persist Security > Info=False;User ID=sa;Password=xxx;Initial Catalog=dlpl;Data > Source=(local)" ) > crsr = conn.cursor() > sql = "select SessionKey, SessionValue from ASPSessionState > where GUID='%s'" % self.id > crsr.execute(sql) > while 1: > info = crsr.fetchone() > if not info: > break > strKey = str(info[0]) > > Opening the database is already good for 2 seconds. > Anyone know how to speed it up? -- http://mail.python.org/mailman/listinfo/python-list