<?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: Faster Way to Get a Random Row MySQL</title>
	<atom:link href="http://k2xl.com/wordpress/2010/03/04/faster-way-to-get-a-random-row-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://k2xl.com/wordpress/2010/03/04/faster-way-to-get-a-random-row-mysql/</link>
	<description>Flash, Web, Casual Games, Interactive Development</description>
	<lastBuildDate>Tue, 10 Jan 2012 11:48:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
	<item>
		<title>By: Robert Hartung</title>
		<link>http://k2xl.com/wordpress/2010/03/04/faster-way-to-get-a-random-row-mysql/comment-page-1/#comment-3160</link>
		<dc:creator>Robert Hartung</dc:creator>
		<pubDate>Wed, 10 Mar 2010 11:51:38 +0000</pubDate>
		<guid isPermaLink="false">http://k2xl.com/wordpress/2010/03/04/faster-way-to-get-a-random-row-mysql/#comment-3160</guid>
		<description>Another solution is on my blog at http://rhcms.de/blog.php ;-) Nice workaround anyway.</description>
		<content:encoded><![CDATA[<p>Another solution is on my blog at <a href="http://rhcms.de/blog.php" rel="nofollow">http://rhcms.de/blog.php</a> <img src='http://k2xl.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Nice workaround anyway.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dano</title>
		<link>http://k2xl.com/wordpress/2010/03/04/faster-way-to-get-a-random-row-mysql/comment-page-1/#comment-3114</link>
		<dc:creator>Dano</dc:creator>
		<pubDate>Fri, 05 Mar 2010 14:39:10 +0000</pubDate>
		<guid isPermaLink="false">http://k2xl.com/wordpress/2010/03/04/faster-way-to-get-a-random-row-mysql/#comment-3114</guid>
		<description>Nice workaround, thanks for sharing.

Other solution will be(with php/mysql):

$total_rows = your_query_invoker(&quot;SELECT Count(*) FROM your_table&quot;);

$pos = rand(0,$total_rows);

$sql = &quot;SELECT * FROM your_table WHERE something LIMIT $pos,1&quot;

The most important thing is that the rand is in php, and consume few CPU. I know that need two calls to MySQL, but if not close the socket connection it is not a big problem.</description>
		<content:encoded><![CDATA[<p>Nice workaround, thanks for sharing.</p>
<p>Other solution will be(with php/mysql):</p>
<p>$total_rows = your_query_invoker(&#8220;SELECT Count(*) FROM your_table&#8221;);</p>
<p>$pos = rand(0,$total_rows);</p>
<p>$sql = &#8220;SELECT * FROM your_table WHERE something LIMIT $pos,1&#8243;</p>
<p>The most important thing is that the rand is in php, and consume few CPU. I know that need two calls to MySQL, but if not close the socket connection it is not a big problem.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

