It's ok, we all make mistakesVladSun wrote:Sorry, I didn't see it.mintedjo wrote:I know, I followed up with a post correcting that.VladSun wrote: ... But your expression is wrongIt should be
Code: Select all
ABS(pxls.x - other_pxls.x) + ABS(pxls.y - other_pxls.y)
Math Php question
Moderator: General Moderators
Re: Math Php question
Re: Math Php question
I don't.mintedjo wrote:It's ok, we all make mistakes
Re: Math Php question
onion2k wrote:I do...mintedjo wrote:It's ok, we all make mistakes
Re: Math Php question
[sql]SELECT pxls.x, pxls.y, ( SELECT sum(abs(pxls.x - other_pxls.x) + abs(pxls.y - other_pxls.y)) FROM pxls AS other_pxls ) AS distance FROM pxls [/sql]
This query executes in 2.51 sec, but no "ORDER BY distance" is applied. So, you have 9'000'000 result records and you need to find MAX and MIN.
But ...
[sql]SELECT pxls.x, pxls.y, ( SELECT sum(abs(pxls.x - other_pxls.x) + abs(pxls.y - other_pxls.y)) FROM pxls AS other_pxls ) AS distance FROM pxls ORDER BY distanceLIMIT 1[/sql]
is very, very slow.
This query executes in 2.51 sec, but no "ORDER BY distance" is applied. So, you have 9'000'000 result records and you need to find MAX and MIN.
But ...
[sql]SELECT pxls.x, pxls.y, ( SELECT sum(abs(pxls.x - other_pxls.x) + abs(pxls.y - other_pxls.y)) FROM pxls AS other_pxls ) AS distance FROM pxls ORDER BY distanceLIMIT 1[/sql]
is very, very slow.
There are 10 types of people in this world, those who understand binary and those who don't
Re: Math Php question
I will be waiting for you to make oneonion2k wrote:I don't.mintedjo wrote:It's ok, we all make mistakes
There are 10 types of people in this world, those who understand binary and those who don't