Home > Uncategorised > Slow Deletes in MythTV

Slow Deletes in MythTV

October 8th, 2008 Leave a comment Go to comments

I noticed a little while ago that I was getting a very slow response time in the MythTV frontend whenever I tried to delete a recorded TV programme.

This was never too much of a problem but it has recently started to irritate me, and tonight I’ve decided to search for an answer.

My initial thought was that it could be a problem with file system fragmentation (and nobody say to me that “Linux does not need to be defragmented” – that’s bollocks and a gross generalisation which does not apply in this instance), however looking into it a bit more, the file fragmentation problem is only really present on systems which are almost full. I have a spare 124GB of data, so that should not be the case for me. An important thing to note though is that fragmentation can occur when recording long files, and especially when you have multiple tuners and are recording more than one programme at the same time (but I’ll post more on that later).

So, I started to search for more MythTV related things. I’ve found this wonderful newsgroup post here:

Slow MySQL Query after delete

The whole thread is here but be warned, it’s absolutely massive.

This seems to (basically) imply that the reason it takes so long is because the frontend has to wait for the backend to delete the programme, which in turn is waiting for a slow MySQL query to finish. The reason that that query is slow is because it is searching for programmes and upcoming recordings that it needs to update.

Now, there are plenty of suggestions about defragging the database, and optimising it (in fact, this post points to a script in the Contrib directory which will optimise the MythTV database for you.

Once you get down to the very bottom of thread, you started to see some more sensible answers being posted, and it’s this one that has peaked my interest. Basically, the theory is that the more “Record at any time on any channel” schedules you have, the more difficult it is for the system to schedule those programmes (i.e. when searching the database for programmes, the number of results returned is therefore greater,) and that therefore takes more time for the query to execute. The simplest way to reduce that query time is to reduce the number of “Record at any time on any channel” schedules that you may have.

I’ve since removed some schedules that were really annoying me (More4 is a pain in the arse, by repeating the same programme 4 times in one day, day after day after day, and not labelling the programmes sensibly so that MythTV can filter the ones that you have already watched!), and I have since noticed that the amount of time has dropped. Slightly. It’s not a massive difference, but the amount of time it is taking is reduced.

I’m going to try and further reduce the number of programmes that I am recording, and see how that goes. I’m also planning on clearing out a load of old programmes as well, so that should help alot. I’m also going to try and to optimise the database, and see how much that helps.

I’ll let you know how I get on….

Categories: Uncategorised Tags:
  1. No comments yet.
  1. No trackbacks yet.