Hi,

On Thu, Jun 25, 2015 at 4:25 AM, Peter Suter <[email protected]> wrote:
> I'm assuming this is a ticket query. Looking at the source control history
> it looks like this changed in #11140
> http://trac.edgewall.org/ticket/11140
> for 12.6, 1.0.2 and 1.1.2 because MySQL and SQLite limit in the number of
> joins, and queries require too many.
>
> If this is a common performance regression, maybe Trac could use joins again
> if there are only a few custom fields.
>
> Just out of curiosity, can you tell us what  DB you are running? How many
> tickets are there in total? How many matching this query?

It seems to be MySQL database since backquote characters are used for
quoting identifiers.

Additionally, would you please post results of EXPLAIN command for the
two queries?

EXPLAIN
SELECT t.id AS id,t.summary AS summary,t.version AS version,t.status
AS status,t.priority AS priority,t.component AS component,t.keywords
AS keywords,t.time AS time,t.changetime AS changetime,t.milestone AS
milestone,
(SELECT c.value FROM ticket_custom c WHERE c.ticket=t.id AND
c.name='contract_number') AS `contract_number`
FROM ticket AS t
LEFT OUTER JOIN enum AS priority ON (priority.type='priority' AND
priority.name=priority)
WHERE (t.status IN ('new','reopened') AND t.version NOT IN
('ILC','INC') AND (t.milestone='Endorsement'))
;

EXPLAIN
SELECT t.id AS id,t.summary AS summary,t.version AS version,t.status
AS status,t.priority AS priority,t.component AS component,t.keywords
AS keywords,t.time AS time,t.changetime AS changetime,t.milestone AS
milestone, c2.value AS `contract_number`
FROM ticket AS t
LEFT OUTER JOIN ticket_custom c2
  on c2.ticket=t.id
  and c2.name='contract_number'
LEFT OUTER JOIN enum AS priority ON (priority.type='priority' AND
priority.name=priority)
WHERE (t.status IN ('new','reopened') AND t.version NOT IN
('ILC','INC') AND (t.milestone='Endorsement'))
;


-- 
Jun Omae <[email protected]> (大前 潤)

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to