Skip to content

Bad performance on simple two joins query on tables with composed index - minutes on Firebird 5 compared to Firebird 3 miliseconds #8250

@Storkware86

Description

@Storkware86

Hello,
in our real-world application we've tested Firebird 5 performance, and it appears to be significantly better in general.

But we have found some issue!

I've included a database file TestDB5.zip, which contains three tables:
TABLE 1 has primary key composed of two fields
TABLE 2 adds one more string field to this key; so it has 3 fields key
TABLE 3 adds one more string field to this key; so it has 4 fields key

The following query, which joins all three tables, took several minutes to execute:

SELECT t2.*, t3.CODE15, t3.PRICE, t1.NAME
FROM TABLE2 t2
JOIN TABLE3 t3 ON t3.ID1 = t2.ID1 AND t3.ID2 = t2.ID2 AND t3.CODE30 = t2.CODE30
JOIN TABLE1 t1 ON t1.ID1 = t2.ID1 AND t1.ID2 = t2.ID2

  • If i change last join to LEFT JOIN, then it runs about 1 sec.
  • If TABLE1 had a primary key consisting of only one field, the query would execute in approximately 1 second.
  • The query also runs in about 1 second on Firebird 3.

I've also included the Firebird 3 database for comparison purposes.

Regards, Jaroslav

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions