result.lociInsertStart = time.time() # Insert each locus for locus in lociInserts: cursor.execute(locus) # Commit data to pgsql postgresConnection.commit() # Log end time and total pgsql time result.lociInsertEnd = time.time() # Close pgsql cursor cursor.close() print result.toTerm() resultsFile.write(result.toString() + '\n') sys.stdout.flush() # Create new cursor, create indexes and run test queries cursor = postgresConnection.cursor() # Turn on triggers, create FK index since PGSQL does not # automatically index FKs print "Turning on key checks..." cursor.execute("ALTER TABLE snp ENABLE trigger ALL;") cursor.execute("ALTER TABLE locus ENABLE trigger ALL;") cursor.execute("CREATE INDEX idx_snpid_fk ON locus (snp_id)") # Create indexes if requested in arguments if createIndexes: