Skip to content

Throttling INSERT function for files over 750KB #616

@sme31

Description

@sme31
  1. What versions are you using?

cx_Oracle 8.3.0
Python 3.7
Ubuntu 16.04
Oracle 12c Enterprise Edition

Also run Python and show the output of:
print("platform.platform:", platform.platform())
print("sys.maxsize > 232:", sys.maxsize > 232)
print("platform.python_version:", platform.python_version())

platform.platform: Linux-4.4.0-210-generic-x86_64-with-Ubuntu-16.04-xenial
sys.maxsize > 2**32: True
platform.python_version: 3.7.10

And:
print("cx_Oracle.version:", cx_Oracle.version)
print("cx_Oracle.clientversion:", cx_Oracle.clientversion())
cx_Oracle.version: 8.3.0
cx_Oracle.clientversion: (21, 5, 0, 0, 0)

  1. Describe the problem

When I try to INSERT a BLOB it takes less than 1 second for files up to 750KB in size. For files between 750KB and 1.5MB it takes 26 seconds. For files between 1.5MB and 2.25MB it takes 52 seconds, and so on. It seems that I am being throttled by 26 seconds for every 750KB of data I am writing.

  1. Include a runnable Python script that shows the problem.
def write_doc(doc,blob,conn):
    sql="INSERT INTO my_data (doc_id,doc_content) VALUES (:dociddata, :blobdata)"
    cursor = conn.cursor()
    cursor.execute(sql, dociddata=doc, blobdata=blob)
    conn.commit()
    cursor.close()

conn = cx_Oracle.connect(user="Myuser", password="MyPassword",dsn="ocm.server.here.com:1527/some_name",encoding="UTF-8")
doc_csv = "/tmp/document_list.csv"
csv_file=open(doc_csv, 'r')

for line in csv_file:
    splitLineArray = line.split(',')
    documentId = splitLineArray[17]

    #Pull document down from SOAP API
    documentData = (client.service.getDocument(int(documentId)))        
    write_doc(documentId, documentData, conn)

Include all SQL needed to create the database schema.

CREATE TABLE my_data (doc_id varchar(40), doc_content blob);

Is this a cx_Oracle problem or a Oracle DB server problem? Any clues how to resolve this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions