Only using "models" when necessary

Traq 4 development discussion.
Post Reply
User avatar
Advanced Member
Posts: 668
Joined: Fri Mar 27, 2009 7:37 pm
Location: Australia

Only using "models" when necessary

Post by Jack » Tue Dec 22, 2015 1:11 am

Traq 4.0 is going to use models less-often. Models will be used a query isn't enough. Though for most data-fetching, a model won't be used.
For example, I've rewritten most of the 4.0 codebase to use a query (well, query builder to hopefully support MySQL and PostgreSQL), with a bunch of joins to fetch other data. This results in one query being used instead of 15 queries, I speak of course of the Ticket Listing page.
Depending on what columns where being displayed:
The ticket listing page used to fetch:
  1. Tickets
  2. Owner
  3. Type
  4. Status
  5. Milestone
  6. Version
  7. Component
  8. Priority
  9. Severity
  10. Assignee
That's 10 queries just to display the tickets, then there were the queries to fetch the necessary information to filter them, such as:
  1. Owner IDs
  2. Milestone IDs
  3. Version IDs
  4. Type IDs
  5. Status IDs
  6. Priority IDs
  7. Severity IDs
  8. Assignee IDs
That's right, some requests were executing 18 queries! Not too much data was being fetched through, so no servers were over-worked and requests never took too long. But still.
But no longer!
In Traq 4.0, I've decided to change that, the ticket listing page now executes one query to fetch the same data.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests