2 Replies Latest reply: Jan 26, 2009 11:39 PM by 451875 RSS

    why using cursor to delete table is very slowly

    664028
      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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        • 1. Re: why using cursor to delete table is very slowly
          390020
          Do you have an index in FILE_PATH column? Do you have your statistics up to date?
          • 2. Re: why using cursor to delete table is very slowly
            451875
            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'