user1124702
user1124702

Reputation: 1135

Running Oracle SQL job in parallel from Python

I have setup my cx_Oracle connection as follows:

cursor = conn.cursor()
cursor.execute("ALTER SESSION SET \"_PARALLEL_CLUSTER_CACHE_POLICY\" =ADAPTIVE")

followed by

df_plcy_trm = pd.read_sql_query(query_plcy_trm, conn)

However, the query does not seem to be running in parallel. The query runs much faster natively in Oracle than through cx_Oracle connection. Please advise.

Upvotes: 0

Views: 891

Answers (1)

Kaushik Nayak
Kaushik Nayak

Reputation: 31676

Alternatively You can execute your query parallelly using the PARALLEL Hint as follows.

query_plcy_trm = """SELECT /*+ PARALLEL */ ename, dname FROM emp e, dept d WHERE e.deptno=d.deptno""";

df_plcy_trm = pd.read_sql_query(query_plcy_trm, conn)

Upvotes: 2

Related Questions