Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-4526

A query (bug1) or a view (bug2) from a smaller db is at least order of magnitude slower than from a larger db despite indexes; the smalller db stores a subset of data stored in the larger db; the databases were created using the same script.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 10.5.3.0
    • None
    • SQL
    • None
    • see sysinfo.txt in the attachment
    • Repro attached
    • Performance

    Description

      See BugDemo.java in the attachment. Below is a code snippet.

      public BugDemo()

      { /* * BUG 1: Although Derby uses indexes, "Hash table size = 31416" (see small_derby1.log) is the suspect in case of small_db */ String sql = "select f.file_id, f.name, f.is_directory from Files f, FileRestorePoints p where p.file_id=f.file_id" +" and p.restore_point_id=1 and f.parent_folder_id=?"; demo("Bug1", large_db, sql); //no problem, 96547 rows, 8312 milliseconds on my PC demo("Bug1", small_db, sql); //too slow, 31416 rows, 504703 milliseconds on my PC, see small_derby1.log in the attachment /* * BUG 2: Derby ignores indexes on table FileRestorePoints or rpTable when selecting from view 'rpView' of small_db on tables * ('Files', 'FileRestorePoints', and 'rpTable') although indexes were created on each of the tables; * * but, in case of large_db, indexes are used properly (both databases were created from the same script) */ sql = "select file_id, name, length, is_directory from rpView where parent_folder_id=?"; demo("Bug2", large_db, sql); //no problem, 96547 rows, 13718 milliseconds on my PC demo("Bug2", small_db, sql); //too slow, 31416 rows, 204110 milliseconds on my PC, see small_derby2.log in the attachment }

      Attachments

        1. BugDemo.java
          4 kB
          Phil Michnik
        2. DERBY-4526 Bug Attachment.z01
          9.76 MB
          Phil Michnik
        3. DERBY-4526 Bug Attachment.z02
          9.76 MB
          Phil Michnik
        4. DERBY-4526 Bug Attachment.z03
          9.76 MB
          Phil Michnik
        5. DERBY-4526 Bug Attachment.z04
          9.76 MB
          Phil Michnik
        6. DERBY-4526 Bug Attachment.z05
          9.76 MB
          Phil Michnik
        7. DERBY-4526 Bug Attachment.z06
          9.76 MB
          Phil Michnik
        8. DERBY-4526 Bug Attachment.z07
          9.76 MB
          Phil Michnik
        9. DERBY-4526 Bug Attachment.z08
          9.76 MB
          Phil Michnik
        10. DERBY-4526 Bug Attachment.z09
          9.76 MB
          Phil Michnik
        11. DERBY-4526 Bug Attachment.z10
          9.76 MB
          Phil Michnik
        12. DERBY-4526 Bug Attachment.zip
          6.84 MB
          Phil Michnik
        13. en_US_caseinsensitive.jar
          1 kB
          Phil Michnik

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pmichnik Phil Michnik
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: