fetchall is taking much longer time while getting data from Sybase module in Python

reetesh nigam nigamreetesh84 at gmail.com
Mon Feb 15 01:07:47 EST 2016

Hi All,

I am retrieving data from Sybase database using Sybase module of Python. 
My query is not taking time however fecthall is taking longer time. 

Below is the test script :

def run_query(db,query): ## Run query and resturn record result
        t1 = datetime.now()
        cursorObj = db.cursor()
        t2 = datetime.now()
        t3 = datetime.now()
        import pdb
        rowset = cursorObj.fetchall()
        t4 = datetime.now()
        print "Time taken to make cursor --%s"%(t2-t1)
        print "Time taken to execute query --%s"%(t3-t2)
        print "Time taken for fetchall--%s"%(t4-t3)
        return rowset

Time taken to make cursor --0:00:00.000037
Time taken to execute query --0:00:00.379443
Time taken for fetchall--0:00:14.739064

More information about the Python-list mailing list