<?xml version="1.0" encoding="UTF-8"?><rss version="0.92">
<channel>
	<title>A Little Noise</title>
	<link>http://thenoyes.com/littlenoise</link>
	<description></description>
	<lastBuildDate>Wed, 25 Aug 2010 16:07:26 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	<!-- generator="WordPress/3.0.1" -->

	<item>
		<title>Multi-master replication</title>
		<description><![CDATA[Implement multi-master to single-slave replication by periodically saving state and changing masters, and do it all in SQL.* Just a proof of concept. I suggest you add some error checking (like, don't make the switch if the slave isn't running). Remember that all this stuff goes on the SLAVE. If you absent-mindedly log in to [...]]]></description>
		<link>http://thenoyes.com/littlenoise/?p=117</link>
			</item>
	<item>
		<title>LOAD DATA and recovery</title>
		<description><![CDATA[A little two-part quiz. If you get the first one without peeking, you're worth your pay as a DBA. If you get the second one without peeking, you may tell your boss that some random guy on the Internet says you deserve a raise. Start with a text file, 'test.txt', with these three lines: 1 [...]]]></description>
		<link>http://thenoyes.com/littlenoise/?p=104</link>
			</item>
	<item>
		<title>Restore from mysqldump --all-databases in parallel</title>
		<description><![CDATA[csplit backup.sql /"^-- Current Database"/ {*}; for f in xx*; do cat xx00 "$f" &#124; mysql& done; and then rm xx* when the background jobs have finished. I haven't done any benchmarking, and I haven't worked out what to do if the number of databases exceeds the number of available connections.]]></description>
		<link>http://thenoyes.com/littlenoise/?p=100</link>
			</item>
	<item>
		<title>mysql&#8217;s --xml and some XSLT</title>
		<description><![CDATA[Somebody asked in Freenode the other day how to get their data out of MySQL into a specific XML format. Both mysqldump and the mysql client have --xml options. The output from the cli looks like this: &#60;resultset statement="SELECT here"&#62; &#160;&#160;&#60;row&#62; &#160;&#160;&#160;&#160;&#60;field name="field1"&#62;value&#60;/field&#62; &#160;&#160;&#160;&#160;&#60;field name="field2"&#62;value&#60;/field&#62; &#160;&#160;&#60;/row&#62; &#160;&#160;&#60;row&#62; &#160;&#160;&#160;&#160;&#60;field name="field1"&#62;value&#60;/field&#62; &#160;&#160;&#160;&#160;&#60;field name="field2"&#62;value&#60;/field&#62; &#160;&#160;&#60;/row&#62; &#60;/resultset&#62; I wanted [...]]]></description>
		<link>http://thenoyes.com/littlenoise/?p=99</link>
			</item>
	<item>
		<title>Make an ALTER TABLE script with MySQL Workbench</title>
		<description><![CDATA[So you have two versions of a database sitting around - maybe you've been trying things out on your development box, and now you want to move it all over to production. If it's just a new table here and an extra column there, you could do it by hand, but if you've made lots [...]]]></description>
		<link>http://thenoyes.com/littlenoise/?p=98</link>
			</item>
	<item>
		<title>Trigger on firing table</title>
		<description><![CDATA[CREATE TABLE t1 (id int); CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (NEW.id); That's not allowed; it won't let you create the trigger. CREATE TABLE t1 (id int); CREATE TABLE f1 (id int) ENGINE=FEDERATED CONNECTION='localhost/test/t1'; CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW INSERT INTO f1 [...]]]></description>
		<link>http://thenoyes.com/littlenoise/?p=97</link>
			</item>
	<item>
		<title>On unions and derivatives</title>
		<description><![CDATA[On occasion I need to generate a number of rows. I don't care about the contents, just how many rows there are. Maybe I want to create a table filled with a sequence of numbers. One common way to do this is to join a bunch of subqueries built out of unions: SET @count := [...]]]></description>
		<link>http://thenoyes.com/littlenoise/?p=95</link>
			</item>
	<item>
		<title>group date</title>
		<description><![CDATA[A non-rigorous, non-scientific, totally off-the-cuff test of which function to pick when you need to group by year and month. I populated a table with 262K rows of random dates, and then ran SELECT %s, COUNT(*) FROM table GROUP BY %s ORDER BY NULL with various functions, which should all result in the same grouping. [...]]]></description>
		<link>http://thenoyes.com/littlenoise/?p=94</link>
			</item>
	<item>
		<title>Drilling a hole in a stainless steel sink</title>
		<description><![CDATA[I needed to drill a couple of 1" holes in the stainless steel kitchen sink to install a pair of soap and lotion dispensers. The most popular answer online was "use a bi-metal hole saw, low speed, lots of pressure, lots of lubricant." I tried that, and the pilot bit wouldn't even scratch it. I [...]]]></description>
		<link>http://thenoyes.com/littlenoise/?p=93</link>
			</item>
	<item>
		<title>GROUP UNCONCAT</title>
		<description><![CDATA[Dunno why you'd rather do this in SQL than in your application layer, but if you do, here's one way to turn a delimited string of values back into multiple rows - just the opposite of GROUP_CONCAT: SET @sourceString = 'a,b,c,d,e'; SET @sql = CONCAT('INSERT INTO t VALUES (\\'', REPLACE(@sourceString, ',', '\\'),(\\''), '\\')'); PREPARE myStmt [...]]]></description>
		<link>http://thenoyes.com/littlenoise/?p=92</link>
			</item>
</channel>
</rss>
