<?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: points in an area in mysql</title>
	<atom:link href="http://verens.com/2008/04/04/points-in-an-area-in-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://verens.com/2008/04/04/points-in-an-area-in-mysql/</link>
	<description>klog - Kae&#039;s Log</description>
	<lastBuildDate>Fri, 10 Feb 2012 21:49:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Strom</title>
		<link>http://verens.com/2008/04/04/points-in-an-area-in-mysql/#comment-1085</link>
		<dc:creator>Strom</dc:creator>
		<pubDate>Sun, 31 Aug 2008 16:26:58 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2008/04/04/points-in-an-area-in-mysql/#comment-1085</guid>
		<description>I use this solution:
CREATE TABLE points (y INT , x INT, y INT)..

id  = y * (yMax) + x;


SELECT FROM points WHERE id IN (xxx);

wery fast ...</description>
		<content:encoded><![CDATA[<p>I use this solution:<br />
CREATE TABLE points (y INT , x INT, y INT)..</p>
<p>id  = y * (yMax) + x;</p>
<p>SELECT FROM points WHERE id IN (xxx);</p>
<p>wery fast &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: judy</title>
		<link>http://verens.com/2008/04/04/points-in-an-area-in-mysql/#comment-1084</link>
		<dc:creator>judy</dc:creator>
		<pubDate>Tue, 03 Jun 2008 20:46:57 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2008/04/04/points-in-an-area-in-mysql/#comment-1084</guid>
		<description>s prazdnikov vasl</description>
		<content:encoded><![CDATA[<p>s prazdnikov vasl</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markku Uttula</title>
		<link>http://verens.com/2008/04/04/points-in-an-area-in-mysql/#comment-1083</link>
		<dc:creator>Markku Uttula</dc:creator>
		<pubDate>Tue, 08 Apr 2008 02:27:07 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2008/04/04/points-in-an-area-in-mysql/#comment-1083</guid>
		<description>In case it isn&#039;t clear to others, calculating a square root is a rather &quot;expensive&quot; operation for the database engine - not to mention that in this case it is entirely unnecessary. If we wanted to know &quot;how far&quot; each point is from our reference point, the calculation would be necessary. However, since we only want to find out if it is &quot;nearer than&quot; the given radius, we can actually factor out the calculation of distance, and based on Pythagoras&#039;s theorem decide that if &quot;x to the second power&quot;+&quot;y to the second power&quot; is less than &quot;radius to the second power&quot;, the point is in fact within the circle we&#039;re interested in.

Damn I wish I&#039;d paid attention in my maths classes while in school. These tidbits come in handy from time to time, and I really hope I&#039;d have managed to get more of them in my head when they were given for free :)</description>
		<content:encoded><![CDATA[<p>In case it isn&#8217;t clear to others, calculating a square root is a rather &#8220;expensive&#8221; operation for the database engine &#8211; not to mention that in this case it is entirely unnecessary. If we wanted to know &#8220;how far&#8221; each point is from our reference point, the calculation would be necessary. However, since we only want to find out if it is &#8220;nearer than&#8221; the given radius, we can actually factor out the calculation of distance, and based on Pythagoras&#8217;s theorem decide that if &#8220;x to the second power&#8221;+&#8221;y to the second power&#8221; is less than &#8220;radius to the second power&#8221;, the point is in fact within the circle we&#8217;re interested in.</p>
<p>Damn I wish I&#8217;d paid attention in my maths classes while in school. These tidbits come in handy from time to time, and I really hope I&#8217;d have managed to get more of them in my head when they were given for free <img src='http://verens.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kae Verens</title>
		<link>http://verens.com/2008/04/04/points-in-an-area-in-mysql/#comment-1082</link>
		<dc:creator>Kae Verens</dc:creator>
		<pubDate>Mon, 07 Apr 2008 20:36:14 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2008/04/04/points-in-an-area-in-mysql/#comment-1082</guid>
		<description>.226 - nice spot! I should have noticed that optimisation as well. That&#039;s what I get for testing at 3am. Almost down to 50% of the time for the unoptimised version.

I have a little work to do now, but I&#039;ll try the center square idea (the last one I mentioned) when I&#039;m finished, to see if it offers any further optimisation. My guess is that it will only shave a few ms off it.</description>
		<content:encoded><![CDATA[<p>.226 &#8211; nice spot! I should have noticed that optimisation as well. That&#8217;s what I get for testing at 3am. Almost down to 50% of the time for the unoptimised version.</p>
<p>I have a little work to do now, but I&#8217;ll try the center square idea (the last one I mentioned) when I&#8217;m finished, to see if it offers any further optimisation. My guess is that it will only shave a few ms off it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markku Uttula</title>
		<link>http://verens.com/2008/04/04/points-in-an-area-in-mysql/#comment-1081</link>
		<dc:creator>Markku Uttula</dc:creator>
		<pubDate>Mon, 07 Apr 2008 19:35:53 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2008/04/04/points-in-an-area-in-mysql/#comment-1081</guid>
		<description>I&#039;d be interested in knowing how (on your system) would this work:

time echo &quot;SELECT COUNT(x) FROM (SELECT x,y FROM points WHERE ABS(x)&lt;=100000 AND ABS(y)&lt;=100000) AS sub1 WHERE (x*x+y*y)&lt;(100000*100000)&quot; &#124; mysql -uusername -ppassword geodb</description>
		<content:encoded><![CDATA[<p>I&#8217;d be interested in knowing how (on your system) would this work:</p>
<p>time echo &#8220;SELECT COUNT(x) FROM (SELECT x,y FROM points WHERE ABS(x)&lt;=100000 AND ABS(y)&lt;=100000) AS sub1 WHERE (x*x+y*y)&lt;(100000*100000)&#8221; | mysql -uusername -ppassword geodb</p>
]]></content:encoded>
	</item>
</channel>
</rss>

