Forum Stats

  • 3,815,605 Users
  • 2,259,059 Discussions
  • 7,893,185 Comments

Discussions

why using cursor to delete table is very slowly

664028
664028 Member Posts: 1
edited Jan 27, 2009 12:39AM in Python
rr=curs.execute ("delete from python_modules where FILE_PATH = 'haha'")---- 6900.27
db.commit() ---- 3.3

------------------------------------------------
using curs to delete table is very very slowly, why ???

help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Answers

  • 390020
    390020 Member Posts: 446
    Do you have an index in FILE_PATH column? Do you have your statistics up to date?
  • 451875
    451875 Member Posts: 14
    It depends on a number of factors, most of which are to do with the database and nothing to do with Python:

    - How many rows are in the table?
    - How big is each row?
    - How much space do you have allocated to rollback segments, temporary tablespaces and swap space?
    - How much memory do you have on the database server?
    - What other transactions are going on in the database when you issue the delete command?
    - What other processes are running on the database server?

    Having said that, the first thing to investigate is how long this statement takes without Python getting involved. Issue the delete statement from a SQL*Plus command line and compare the execution time. If it is similar to the time you posted using Python then I think that you can rule out 'using cursor to delete table is very slowly'
This discussion has been closed.