<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Generating numbers out of seemingly thin air</title>
	<atom:link href="http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/feed" rel="self" type="application/rss+xml" />
	<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air</link>
	<description>Blog by Shlomi Noach</description>
	<lastBuildDate>Wed, 01 Feb 2012 20:47:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/comment-page-1#comment-3641</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Wed, 02 Sep 2009 03:38:45 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1148#comment-3641</guid>
		<description>@adj4096

Would you care to elaborate? 
If so, you can use the INFORMATION_SCHEMA tables.</description>
		<content:encoded><![CDATA[<p>@adj4096</p>
<p>Would you care to elaborate?<br />
If so, you can use the INFORMATION_SCHEMA tables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajd4096</title>
		<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/comment-page-1#comment-3637</link>
		<dc:creator>ajd4096</dc:creator>
		<pubDate>Tue, 01 Sep 2009 23:02:59 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1148#comment-3637</guid>
		<description>Don&#039;t be so sure that the help tables are *always* installed.</description>
		<content:encoded><![CDATA[<p>Don't be so sure that the help tables are *always* installed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Wultsch</title>
		<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/comment-page-1#comment-3631</link>
		<dc:creator>Rob Wultsch</dc:creator>
		<pubDate>Tue, 01 Sep 2009 15:24:18 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1148#comment-3631</guid>
		<description>A much cleaner way of doing what is described above can be found in generate_series ( http://www.postgresql.org/docs/8.4/static/functions-srf.html ) which is found in a different free RDMS...</description>
		<content:encoded><![CDATA[<p>A much cleaner way of doing what is described above can be found in generate_series ( <a href="http://www.postgresql.org/docs/8.4/static/functions-srf.html" rel="nofollow">http://www.postgresql.org/docs/8.4/static/functions-srf.html</a> ) which is found in a different free RDMS...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toby</title>
		<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/comment-page-1#comment-3630</link>
		<dc:creator>Toby</dc:creator>
		<pubDate>Tue, 01 Sep 2009 13:18:23 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1148#comment-3630</guid>
		<description>strcmp, It can be phrased as a self join, but may not be efficient (even quadratic): https://slashdot.org/~toby/journal/199210</description>
		<content:encoded><![CDATA[<p>strcmp, It can be phrased as a self join, but may not be efficient (even quadratic): <a href="https://slashdot.org/~toby/journal/199210" rel="nofollow">https://slashdot.org/~toby/journal/199210</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: strcmp</title>
		<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/comment-page-1#comment-3629</link>
		<dc:creator>strcmp</dc:creator>
		<pubDate>Tue, 01 Sep 2009 12:52:39 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1148#comment-3629</guid>
		<description>as a former assembler and C programmer and number cruncher iterative code like &quot;@counter := @counter + 1&quot; looks suboptimal to me, because it is a data dependency between the iterations, forcing the code to be executed serially. of course that&#039;s just me and a totally useless comment right now, but even MySQL may once leave the stone ages and execute JOINs and table/index scans in parallel... bulk operations &#039;feel&#039; better.</description>
		<content:encoded><![CDATA[<p>as a former assembler and C programmer and number cruncher iterative code like "@counter := @counter + 1" looks suboptimal to me, because it is a data dependency between the iterations, forcing the code to be executed serially. of course that's just me and a totally useless comment right now, but even MySQL may once leave the stone ages and execute JOINs and table/index scans in parallel... bulk operations 'feel' better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/comment-page-1#comment-3625</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Tue, 01 Sep 2009 11:15:56 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1148#comment-3625</guid>
		<description>@Giuseppe,
Thanks for the references; Very interesting!

@Mark,
What a coincidence! 

@strcmp,
My personal view is that shorter is usually better. Your solution has the property of choosing exactly 1000 thousand values, though.</description>
		<content:encoded><![CDATA[<p>@Giuseppe,<br />
Thanks for the references; Very interesting!</p>
<p>@Mark,<br />
What a coincidence! </p>
<p>@strcmp,<br />
My personal view is that shorter is usually better. Your solution has the property of choosing exactly 1000 thousand values, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: strcmp</title>
		<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/comment-page-1#comment-3619</link>
		<dc:creator>strcmp</dc:creator>
		<pubDate>Tue, 01 Sep 2009 09:14:47 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1148#comment-3619</guid>
		<description>I mostly use UNIONs for this purpose:

SELECT a.x*100+b.x*10+c.x
FROM (
SELECT 0 x UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
) a, (
SELECT 0 x UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
) b, (
SELECT 0 x UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
) c

I don&#039;t know what&#039;s better. You don&#039;t need more priviledges for this than SELECT and it works with 4.1, but of course that puts more load onto the parser and you have much more UNIONs. I&#039;m hoping that generating the bulk of the data with JOINs uses optimized code in the MySQL server like the JOIN buffer and temporary tables and that the overhead doesn&#039;t matter any more.</description>
		<content:encoded><![CDATA[<p>I mostly use UNIONs for this purpose:</p>
<p>SELECT a.x*100+b.x*10+c.x<br />
FROM (<br />
SELECT 0 x UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9<br />
) a, (<br />
SELECT 0 x UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9<br />
) b, (<br />
SELECT 0 x UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9<br />
) c</p>
<p>I don't know what's better. You don't need more priviledges for this than SELECT and it works with 4.1, but of course that puts more load onto the parser and you have much more UNIONs. I'm hoping that generating the bulk of the data with JOINs uses optimized code in the MySQL server like the JOIN buffer and temporary tables and that the overhead doesn't matter any more.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/comment-page-1#comment-3618</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Tue, 01 Sep 2009 08:03:16 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1148#comment-3618</guid>
		<description>Interesting stuff about the help_topic table, thanks. I&#039;d just worked out how to calculate the Fibonacci sequence on my blog (using one of my defined tables to join against) as part of my investigation into solving problems on the Euler project.  http://www.oxfordtechnotes.co.uk/sqlblog/blog4.php/2009/08/29/project-euler-q2-with-mysql  I may well use the help_topic table in future.</description>
		<content:encoded><![CDATA[<p>Interesting stuff about the help_topic table, thanks. I'd just worked out how to calculate the Fibonacci sequence on my blog (using one of my defined tables to join against) as part of my investigation into solving problems on the Euler project.  <a href="http://www.oxfordtechnotes.co.uk/sqlblog/blog4.php/2009/08/29/project-euler-q2-with-mysql" rel="nofollow">http://www.oxfordtechnotes.co.uk/sqlblog/blog4.php/2009/08/29/project-euler-q2-with-mysql</a>  I may well use the help_topic table in future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giuseppe Maxia</title>
		<link>http://code.openark.org/blog/mysql/generating-numbers-out-of-seemingly-thin-air/comment-page-1#comment-3617</link>
		<dc:creator>Giuseppe Maxia</dc:creator>
		<pubDate>Tue, 01 Sep 2009 07:54:06 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1148#comment-3617</guid>
		<description>On the same vein, you may like these two posts:

http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html
http://datacharmer.blogspot.com/2007/12/pop-quiz-with-prize-generate-4-billion.html

Giuseppe</description>
		<content:encoded><![CDATA[<p>On the same vein, you may like these two posts:</p>
<p><a href="http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html" rel="nofollow">http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html</a><br />
<a href="http://datacharmer.blogspot.com/2007/12/pop-quiz-with-prize-generate-4-billion.html" rel="nofollow">http://datacharmer.blogspot.com/2007/12/pop-quiz-with-prize-generate-4-billion.html</a></p>
<p>Giuseppe</p>
]]></content:encoded>
	</item>
</channel>
</rss>

