473,473 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

slow sql server DB reads

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?
Jul 19 '05 #1
2 1448
On 23 May 2005 14:15:03 -0700, sm**@scarlet.be (bart) declaimed the
following in comp.lang.python:

sql = "select SessionKey, SessionValue from ASPSessionState
where GUID='%s'" % self.id
crsr.execute(sql)
Recommendation is to use something of the nature

sql = "select .... where GUID=%s"
crsr.execute(sql, self.id)

.execute() should properly quote the argument.
while 1:
info = crsr.fetchone()
Probably not a speed improvement but...

for info in crsr.fetchall(): #or something like that, check the
# api spec strKey = str(info[0])
I presume you make use of SessionValue somewhere in the program
<G>

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 19 '05 #2
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?

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Buddy Ackerman | last post by:
I'm trying to write files directly to the client so that it forces the client to open the Save As dialog box rather than display the file. On some occasions the files are very large (100MB+). On...
46
by: dunleav1 | last post by:
I have a process that does inserts that runs 50% slower that Oracle and Mssql. Queries normally take 50% slower than normal. DB2, Oracle, Mssql all are configured on same os, same disk array...
4
by: Andrew Jackson | last post by:
I am writing a newsgroup client. I have the protocol figured out. But I get slow transfer speeds off any of the network objects read the data from For example one of the commands for a news...
5
by: Lennart | last post by:
Here is a problem I would like some opinions on. I have a stored procedure (I suspect that the problem exists for other procedures as well, but I haven't verified it). First time it runs (each day)...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.