I’m attempting to run a SQL query to select two columns from a table. The issue comes when I use the cursor.fetchall()
method, which takes 0.2 seconds to return the columns when in other similar cases it takes <0.01 seconds. The returned list is only 1-5 tuples long, so isn’t an extreme amount of data.
<code>cursor.execute(f"SELECT Subject, Code FROM blockPeriodsTable WHERE dataIndex={num} AND Block='A'")
blockPeriodsTemp = cursor.fetchall()
</code>
<code>cursor.execute(f"SELECT Subject, Code FROM blockPeriodsTable WHERE dataIndex={num} AND Block='A'")
blockPeriodsTemp = cursor.fetchall()
</code>
cursor.execute(f"SELECT Subject, Code FROM blockPeriodsTable WHERE dataIndex={num} AND Block='A'")
blockPeriodsTemp = cursor.fetchall()
Is there a way to speed this up or is it not possible?
5