Catching Bugs Before They Catch You

top - crushed

I got itchy about magic quotes the other day because it’s the cause (through a fairly long cascade of errors) of some performance problems and runaways I’ve been seeing lately (pictured above).

But I deserve most of the blame for allowing a query like this to run at all:

SELECT type, data, count(*) AS hits
	FROM wpopac_WPopac_bibs_atsk
	WHERE data LIKE ‘%’
	AND type IN (’subjkey’,'author’, ‘title’)
	GROUP BY data
	ORDER BY hits DESC
	LIMIT 7

As executed, it’s trying to select all 1.2 million records from the table, group them (a hugely memory intensive activity with text), and then report only the top seven.

It’s one of a few queries that returns the alternate searches in WPopac. I’m planning to rethink how that works, but I also should have built in a fail-safe to prevent it from trying to execute if the search variable is empty (the query above is written WHERE data LIKE '$searchterms%' or something like that). I’m amused that MySQL tries so hard to fulfill the search — so hard that it’ll consume all available RAM and swap to do so.

The sysadmin and DBA are now much happier — along with any user frustrated by poor performance — with this patched.

bug, bugs, mysql, patch, performance, queries, query, query failures, wpopac

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

 

User contributed tags for this post:

catching bugs (27) - catch you (10) - how to catch bugs (10) - about (9) - catch sexy (4) - catching june bugs (4) - how to catch june bugs (3) - preventing catching bug (2) - catch bugs (2) - cute childrens quotes about catching bugs (2) - how do I prevent catching bugs on planes (2) - sex catch fighting (2) - how to catch junebugs (2) - how to prevent catching bugs (2) - catching bugs videos (1) - www.com catch (1) - catch bugs information technology (1) - preventing junebugs (1) - ways to catch bugs (1) - how to catch a june bug (1) - bugs to catch (1) - preventing catching bugs (1) - www.com vidéo catch (1) - before 16 sex com (1) - How long before you catch bugs (1) - catch (1) - funny bug catching quotes (1) - BUGS THAT ARE ON YOU (1) - catch fighting (1) - catch s xy (1) - video de catch (1) - quote catching bugs (1) - HOW DO THEY CATCH YOU (1) - catch bugs video google (1) - catch sexy 2 (1) - quote catch bug (1) - videos catch sexy (1) - june bugs how to catch (1) - catching quotes (1) - catch june bugs (1) -