Opened 15 years ago

Closed 14 years ago

#7330 closed patch (invalid)

Inefficient SQL in Mythweb

Reported by: Mark Edwards <mythtv-trac@…> Owned by: Rob Smith
Priority: trivial Milestone: unknown
Component: Plugin - MythWeb Version: head
Severity: low Keywords: Mythweb SQL
Cc: Ticket locked: no

Description

I noticed a query in Mythweb that looks to me a little inefficient. The main issue is it LEFT JOINS to two large tables that aren't actually selected from (credits and people). It also could make use of channel.visible=1 to cut down unwanted results and it may as well do an inner join of program to channel cos if either isn't there it's cos something weird has happened and we wouldn't want it in the result set anyway. The attached patch changes this.

Further to this I believe (but I'm not sure) that the sorting clause could be removed from this query as Mythweb appears to always sort the results anyway, but perhaps someone with more knowledge could verify this.

This query was one that used to always turn up in my slow query logs, with the attached patch and the additional removal of the sorting clause it no longer does :)

Attachments (1)

mythweb.patch (1.1 KB) - added by Mark Edwards <mythtv-trac@…> 15 years ago.

Download all attachments as: .zip

Change History (2)

Changed 15 years ago by Mark Edwards <mythtv-trac@…>

Attachment: mythweb.patch added

comment:1 Changed 14 years ago by Rob Smith

Resolution: invalid
Status: newclosed

We use the same codeblock for the search module, and thus those joins *do* get used and a invisable channel doesn't indicate you don't want to see the shows, just not the channel in the channel list.

Note: See TracTickets for help on using tickets.