[Tutor] Sloooooow SQL

Øyvind python at kapitalisten.no
Fri Mar 30 12:59:26 CEST 2007


Hello.

I have been writing some scripts that gets data from a MSSQL-database.
However, it is very slow. If I use the script, the retrieving of data and
displaying in html takes close to 30 seconds. If I use the SQL Server
Management Query, the same query takes a second or two. Why this enormous
difference? Below is the top of one of the scripts.

Thanks in advance.


from win32com.client import Dispatch
import MSSQL
import cgitb, cgi, os, urllib
cgitb.enable()

print "Content-type: text/html"

print """<HTML>
<HEAD>
<TITLE>SQL</TITLE></HEAD><BODY>
<link href="style.css" rel="stylesheet" type="text/css">"""

form = cgi.FieldStorage()
db = MSSQL.connect('10.10.10.10','admin','admin','MYDB')
cursor = db.cursor()

ejfirma = """select x_firmanavn from ad_kopi order by x_firmanavn"""
cursor.execute(ejfirma)
result = cursor.fetchall()


-- 
This email has been scanned for viruses & spam by Domenebutikken - www.domenebutikken.no
Denne e-posten er sjekket for virus & spam av Domenebutikken - www.domenebutikken.no



More information about the Tutor mailing list