Mailing List Archive

superfluous query for ticket links for merged ticket id's
Hi,

if you merge ticket 2 into 1, all links are moved from ticket 2 to 1 [1].
If you later query ticket 1 for linked tickets, the link query limits by
the ticket id and RT::Ticket->Merged [2], which starts a query for
tickets that are merged into this ticket [3].

As ticket links are moved on merge, limit the RT::Ticket->_Links also by
merged ticket id's looks unnecessary for me.

Chris

[1] https://github.com/bestpractical/rt/blob/stable/lib/RT/Ticket.pm#L1849
[2] https://github.com/bestpractical/rt/blob/stable/lib/RT/Ticket.pm#L1751
[3] https://github.com/bestpractical/rt/blob/stable/lib/RT/Ticket.pm#L1751
---------
RT 4.4 and RTIR Training Sessions (http://bestpractical.com/services/training.html)
* Hamburg Germany - March 14 & 15, 2016
* Washington DC - May 23 & 24, 2016
Re: superfluous query for ticket links for merged ticket id's [ In reply to ]
On 2016年2月18日 at 9:12:02, Christian Loos (cloos@netcologne.de) wrote:
> Hi,

Hi Chris,

> if you merge ticket 2 into 1, all links are moved from ticket 2 to 1 [1].
> If you later query ticket 1 for linked tickets, the link query limits by
> the ticket id and RT::Ticket->Merged [2], which starts a query for
> tickets that are merged into this ticket [3].
>
> As ticket links are moved on merge, limit the RT::Ticket->_Links also by
> merged ticket id's looks unnecessary for me.

I think you’re right. The code to consult merged tickets for links was added first, in 2002, here:

https://github.com/bestpractical/rt/commit/6020dac5c3487e41eb9a0a5203a617f9793e8c61#diff-07fe0337ce0b1c48d62516cb36bb3e33R2205

The code to move links on merge was added later, in 2003:

https://github.com/bestpractical/rt/commit/53ea76636e0e288bdebf2f9a6cdac63bdce8ef47#diff-07fe0337ce0b1c48d62516cb36bb3e33R2814

I suspect the latter change indeed made the former obsolete, but since it wasn’t breaking anything, no one ever toucheed it. I too think we can remove it.

> Chris
>
> [1] https://github.com/bestpractical/rt/blob/stable/lib/RT/Ticket.pm#L1849
> [2] https://github.com/bestpractical/rt/blob/stable/lib/RT/Ticket.pm#L1751
> [3] https://github.com/bestpractical/rt/blob/stable/lib/RT/Ticket.pm#L1751

Thanks!
Shawn
---------
RT 4.4 and RTIR Training Sessions (http://bestpractical.com/services/training.html)
* Hamburg Germany - March 14 & 15, 2016
* Washington DC - May 23 & 24, 2016
Re: superfluous query for ticket links for merged ticket id's [ In reply to ]
Am 23.02.2016 um 19:23 schrieb Shawn Moore:
> I think you’re right. The code to consult merged tickets for links was added first, in 2002, here:
>
> https://github.com/bestpractical/rt/commit/6020dac5c3487e41eb9a0a5203a617f9793e8c61#diff-07fe0337ce0b1c48d62516cb36bb3e33R2205
>
> The code to move links on merge was added later, in 2003:
>
> https://github.com/bestpractical/rt/commit/53ea76636e0e288bdebf2f9a6cdac63bdce8ef47#diff-07fe0337ce0b1c48d62516cb36bb3e33R2814
>
> I suspect the latter change indeed made the former obsolete, but since it wasn’t breaking anything, no one ever toucheed it. I too think we can remove it.

I think this could in some situations, slightly improve the performance
of the ticket search results page.
As you can add linked tickets to the ticket search result, this leads to
one additional query for each ticket, with the default search limit of
50, this are 50 additional queries.

In my case, this is more worse, because I created a custom report where
I have to inspect the links for 1000 tickets, so there are 1000
additional queries. :-(

So maybe this is something that is worth to go into RT 4.2?!

Should I send a PR or will you put this on your TODO list?

Chris
---------
RT 4.4 and RTIR Training Sessions (http://bestpractical.com/services/training.html)
* Hamburg Germany - March 14 & 15, 2016
* Washington DC - May 23 & 24, 2016
Re: superfluous query for ticket links for merged ticket id's [ In reply to ]
Am 23.02.2016 um 19:23 schrieb Shawn Moore:
> I think you’re right. The code to consult merged tickets for links was added first, in 2002, here:
>
> https://github.com/bestpractical/rt/commit/6020dac5c3487e41eb9a0a5203a617f9793e8c61#diff-07fe0337ce0b1c48d62516cb36bb3e33R2205
>
> The code to move links on merge was added later, in 2003:
>
> https://github.com/bestpractical/rt/commit/53ea76636e0e288bdebf2f9a6cdac63bdce8ef47#diff-07fe0337ce0b1c48d62516cb36bb3e33R2814
>
> I suspect the latter change indeed made the former obsolete, but since it wasn’t breaking anything, no one ever toucheed it. I too think we can remove it.

I think this could in some situations, slightly improve the performance
of the ticket search results page.
As you can add linked tickets to the ticket search result, this leads to
one additional query for each ticket, with the default search limit of
50, this are 50 additional queries.

In my case, this is more worse, because I created a custom report where
I have to inspect the links for 1000 tickets, so there are 1000
additional queries. :-(

So maybe this is something that is worth to go into RT 4.2?!

Should I send a PR or will you put this on your TODO list?

Chris

---------
RT 4.4 and RTIR Training Sessions (http://bestpractical.com/services/training.html)
* Hamburg Germany - March 14 & 15, 2016
* Washington DC - May 23 & 24, 2016