Issue Details (XML | Word | Printable)

Key: JRA-5169
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Jeff Turner [Atlassian]
Votes: 0
Watchers: 0
Operations

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

Avoid generating useless SQL rollback and commit queries

Created: 08/Nov/04 05:48 PM   Updated: 27/Mar/07 10:01 AM
Component/s: Backend / Domain Model
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Environment: JIRA 3.0.2 Enterprise, MySQL 4.0

Participants: Jeff Turner [Atlassian] and Ray Oei [Furore]
Since last comment: 1 year, 28 weeks, 5 days ago
Labels:


 Description  « Hide
JIRA generates vast amounts of useless SQL for most operations. For every valid line of SQL, there are:
  • three SET autocommit statements
  • a commit
  • a rollback immediately after

Typical output looks like:

1757 Query commit
1757 Query rollback
1757 Query SET autocommit=1
1757 Query SET autocommit=1
1757 Query SET autocommit=0
1757 Query SELECT ID, LINKTYPE, SOURCE, DESTINATION, SEQUENCE FROM issuelink WHERE SOURCE=10020
1757 Query commit
1757 Query rollback
1757 Query SET autocommit=1
1757 Query SET autocommit=1
1757 Query SET autocommit=0
1757 Query SELECT SOURCE_NODE_ID, SOURCE_NODE_ENTITY, SINK_NODE_ID, SINK_NODE_ENTITY, ASSOCIATION_TYPE, SEQUENCE FROM nodeassociation WHERE SOURCE_NODE_ID=10000 AND SOURCE_NODE_ENTITY='Project' AND SINK_NODE_ENTITY='VersionControl' AND ASSOCIATION_TYPE='ProjectVersionControl'
1757 Query commit
1757 Query rollback
1757 Query SET autocommit=1
1757 Query SET autocommit=1
1757 Query SET autocommit=0
1757 Query SELECT ID, issueid, AUTHOR, actiontype, actionlevel, actionbody, CREATED, actionnum FROM jiraaction WHERE issueid=10020 AND actiontype='comment'
1757 Query commit
1757 Query rollback
1757 Query SET autocommit=1
041109 10:01:28 1757 Query SET autocommit=1
1757 Query SET autocommit=0

Creating an issue generates 657 SQL queries, of which 540 are useless (commits, rollbacks, sets). Of the remaining 117, 44 are duplicates of queries made earlier (a separate issue).

It is hard to tell what effect on performance all this has. One hopes that databases run these statements very quickly. MySQL takes 0.3ms per set of (commit,rollback,3 x set), amounting to 32ms for the insert. The increase in network overhead is probably a lot more significant.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Ray Oei [Furore] added a comment - 27/Mar/07 10:01 AM
Yep... would be an improvement.
Just giving it a bit more attention.
It makes some actions quite slow..which is a pitty.
Using MSSQL btw.