LibriVox / librivox-catalog

LibriVox catalog and reader workflow application
https://librivox.org
MIT License
37 stars 17 forks source link

Avoid SELECT DISTINCT SQL queries where possible #82

Open notartom opened 3 years ago

notartom commented 3 years ago

Every so often, running mytop shows a bunch of queries running for many seconds (sometimes over 10), in state Copying. Copying means copying to a temporary table, and is inefficient.

It looks as though using SELECT DISTINCT queries forces the creation of temporary tables [1]. We should get rid of these unless there's no way around them.

[1] https://dba.stackexchange.com/questions/34674/mysql-performance-tuning-queries-stuck-on-copying-to-tmp-tables

notartom commented 3 years ago

Let's re-open this to remind ourselves that there are still 2 spots where SELECT DISTINCT is in use.

twinkietoes-on commented 2 years ago

This is what is causing names to show up on the Archive description more than once, when the reader has more than one section, correct? It would be nice to get this fixed.

notartom commented 2 years ago

This is what is causing names to show up on the Archive description more than once, when the reader has more than one section, correct? It would be nice to get this fixed.

... maybe? :) Could you link to an example? If that's indeed the case, we can revert the part of https://github.com/LibriVox/librivox-catalog/commit/29255e2fb5e94088f5aecce22b224a91eb2b0014 that's causing it.

twinkietoes-on commented 2 years ago

This is what is causing names to show up on the Archive description more than once, when the reader has more than one section, correct? It would be nice to get this fixed.

... maybe? :) Could you link to an example? If that's indeed the case, we can revert the part of 29255e2 that's causing it.

Right now this one shows duplicate readers: https://archive.org/details/fairylady_2112_librivox but we MCs go in and edit the description, so you won't see it for long.