Issue Details (XML | Word | Printable)

Key: JRA-5260
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Jarno Peltoniemi
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
JIRA

Automatic creation of foreign keys and indices fails on Oracle database

Created: 18/Nov/04 01:33 AM   Updated: 29/Jun/06 07:13 PM
Component/s: Backend / Domain Model
Affects Version/s: 3.0.2
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Oracle database
Issue Links:
Reference
 

Participants: Jarno Peltoniemi, Jeff Turner [Atlassian], John Andrea and Scott Farquhar [Atlassian]
Since last comment: 2 years, 10 weeks, 1 day ago
Labels:


 Description  « Hide
Turning on automatic creation of foreign keys and indices while using Oracle database results in a lot of errors. This is due to the Oracle restriction that all foreign keys must be uniquely named. JIRA has multiple foreign keys with the same name. There are, for example, multiple 'ParentIssue' relations.

I was able to make a workaround extending GenericHelperDAO to uniquely name all the foreign keys. Maybe JIRA should do that way by default.

Uniquely naming all the foreign keys won't solve all the errors though. See the related issue.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Scott Farquhar [Atlassian] added a comment - 18/Nov/04 01:42 AM
Jarno,

I'm not sure what the problem is here? We specifically don't turn that option on for that exact reason.

Can you outline the problems that you get with it turned off, or let us know why you can't run JIRA without them turned on?


Jarno Peltoniemi added a comment - 18/Nov/04 02:30 AM
I want foreign keys mainly to ensure referential integrity of the database. Additionally, I want to have an up-to-date documentation about the JIRA domain model in the database. Visualizing the domain model without foreign keys results in 72 unrelated tables floating in the air.

I want indices to speed up JIRA by avoiding full table scans on queries. I've received complaints about JIRA being too slow at the moment. The application server CPU usage and the database CPU usage are constantly near zero. Analytics showed many SQL queries doing full table scans, even the third most used SQL query was doing full table scan on jiraissues-table. This is not acceptable. I could add indexes to fix individual selects but I'd rather see JIRA adding indices automatically.


Jeff Turner [Atlassian] added a comment - 18/Nov/04 11:39 PM
> I want foreign keys mainly to ensure referential integrity of the database. Additionally, I want to have an up-to-date documentation about the JIRA domain model in the database. Visualizing the domain model without foreign keys results in 72 unrelated tables floating in the air.

The JIRA data model is defined in WEB-INF/classes/entitydefs/entitymodel.xml. This is where the tables (entities) and relations are defined., eg:

<entity entity-name="OSUser" table-name="userbase" package-name="">
...
<relation type="many" title="Child" rel-entity-name="ColumnLayout">
<key-map field-name="name" rel-field-name="username"/>
</relation>

The only relations not captured in entitymodel.xml are the M-N relations, in the join tables nodeassociation and propertyentry.

> I want indices to speed up JIRA by avoiding full table scans on queries. I've received complaints about JIRA being too slow at the moment. The application server CPU usage and the database CPU usage are constantly near zero. Analytics showed many SQL queries doing full table scans, even the third most used SQL query was doing full table scan on jiraissues-table. This is not acceptable. I could add indexes to fix individual selects but I'd rather see JIRA adding indices automatically.

JIRA 3 does add indexes automatically (also defined in entitymodel.xml), but only for new databases. You could get them added by creating an XML backup, pointing JIRA at a clean database (where the schema will be created with indexes), and importing the XML backup.

Alternatively, indexes can be created manually. See:

http://www.atlassian.com/software/jira/docs/latest/indexing.html

If you are having performance problems, there are a lot of potential causes. The following page lists some common ones:

http://www.atlassian.com/software/jira/docs/latest/performance.html


Jarno Peltoniemi added a comment - 23/Nov/04 01:15 AM
Having the relations defined in the entityengine.xml doesn't ensure referential integrity in the database. It would be really awesome to have a consistent data model in the database and not only on the application level.

Thanks for pointing me to the indexing-document. I hope it solves the performance issues. Still, autocreation of indices and foreign keys would be a nice feature, if it was fixed to work.


Jeff Turner [Atlassian] added a comment - 26/May/05 03:42 AM
> It would be really awesome to have a consistent data model in the database and not only on the application level.

It would, but we are quite far from having it at the moment; not only because of small entitymodel.xml problems like JRA-5261, but because we'd need to rewrite various bits of code where it is hard to maintain referential integrity (import, export, workflow edits) to use transactions.

Still, thanks for raising the issue - it's a good thing for us to keep in mind and aim for.


John Andrea added a comment - 28/Jun/06 01:08 PM
It appears that there are no foreign keys also in Postgresql. Is this also due to JRA-5261 ?

Could you also clarify the above comment. Are all database modifications wrapped in transactions ?


Jeff Turner [Atlassian] added a comment - 29/Jun/06 07:13 PM
> It appears that there are no foreign keys also in Postgresql. Is this also due to JRA-5261 ?

Not specifically.

> Could you also clarify the above comment. Are all database modifications wrapped in transactions ?

No. For some operations like workflow migrations we manually start a transaction.