Jump to content

Click here to lend your support to: Traq and make a donation at pledgie.com !

Only using "models" when necessary

  • Please log in to reply
No replies to this topic

#1 Jack


    Project Founder

  • Administrators
  • 673 posts
  • LocationAustralia

Posted 21 December 2015 - 02:11 PM

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users