Skip to content

Delete statement takes a long time to commit #491

@trishtzy

Description

@trishtzy
  1. What versions are you using?
    platform.platform: Linux-4.15.0-107-generic-x86_64-with-glibc2.2.5
    sys.maxsize > 2**32: True
    platform.python_version: 3.8.2
    cx_Oracle.version: 8.0.1
    cx_Oracle.clientversion: (19, 8, 0, 0, 0)
  1. Describe the problem

I need to execute a delete statement that completes under 7 minutes.

I've about 168k rows of data to be deleted. When I use execute the delete statement in TOAD application, it completes under 2 minutes. But when using python script and cx_oracle, it takes more than 15 minutes to be completed.

Is there a better way of deleting 100k rows of data using cx_oracle?

  1. Include a runnable Python script that shows the problem.
delete_sql = "delete from ARCHIVE_WORK where pxinsname = :1"
try:
    cursor.executemany(delete_sql, dealsToDelete)
    connection.commit()
except cx_Oracle.Error as error:
    error_alert(error)

where dealsToDelete is a list of lists.
dealsToDelete = [['D-123'], ['D-234'], ['D-345']]
So if there are 168k rows, length of dealsToDelete is 168k.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions