man, I feel like a beginner ...

Started by The Hermit Hackerover 25 years ago4 messages
#1The Hermit Hacker
scrappy@hub.org

someone notice anything wrong with this query? :) *slap forehead*

explain
SELECT distinct s.gid, s.created , geo_distance(pd.location, '(-90.3690233918754,38.7788148984854)')
FROM status s, personal_data pd, relationship_wanted rw , personal_ethnicity pe , personal_religion pr , personal_bodytype pb
WHERE s.active AND s.status != 0
AND (s.gid = pd.gid AND pd.gender = 0)
AND (s.gid = rw.gid AND rw.gender = 1)
AND geo_distance( pd.location, '(-90.3690233918754,38.7788148984854)' ) <= 75
ORDER BY geo_distance( pd.location, '(-90.3690233918754,38.7788148984854)'), s.created desc;

Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org

#2Zeugswetter Andreas SB
ZeugswetterA@wien.spardat.at
In reply to: The Hermit Hacker (#1)
AW: man, I feel like a beginner ...

someone notice anything wrong with this query? :) *slap forehead*

explain
SELECT distinct s.gid, s.created ,
geo_distance(pd.location, '(-90.3690233918754,38.7788148984854)')
FROM status s, personal_data pd, relationship_wanted rw ,
personal_ethnicity pe , personal_religion pr , personal_bodytype pb
WHERE s.active AND s.status != 0
AND (s.gid = pd.gid AND pd.gender = 0)
AND (s.gid = rw.gid AND rw.gender = 1)
AND geo_distance( pd.location,
'(-90.3690233918754,38.7788148984854)' ) <= 75
ORDER BY geo_distance( pd.location,
'(-90.3690233918754,38.7788148984854)'), s.created desc;

You have not restricted the join on pe, pr and pb leading to a cartesian
product ?

Andreas

#3Jan Wieck
janwieck@Yahoo.com
In reply to: The Hermit Hacker (#1)
Re: man, I feel like a beginner ...

The Hermit Hacker wrote:

someone notice anything wrong with this query? :) *slap forehead*

explain
SELECT distinct s.gid, s.created , geo_distance(pd.location, '(-90.3690233918754,38.7788148984854)')
FROM status s, personal_data pd, relationship_wanted rw , personal_ethnicity pe , personal_religion pr , personal_bodytype pb
WHERE s.active AND s.status != 0
AND (s.gid = pd.gid AND pd.gender = 0)
AND (s.gid = rw.gid AND rw.gender = 1)
AND geo_distance( pd.location, '(-90.3690233918754,38.7788148984854)' ) <= 75
ORDER BY geo_distance( pd.location, '(-90.3690233918754,38.7788148984854)'), s.created desc;

What's the purpose of joining it with "pb"?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #

#4The Hermit Hacker
scrappy@hub.org
In reply to: Jan Wieck (#3)
Re: man, I feel like a beginner ...

On Wed, 13 Sep 2000, Jan Wieck wrote:

The Hermit Hacker wrote:

someone notice anything wrong with this query? :) *slap forehead*

explain
SELECT distinct s.gid, s.created , geo_distance(pd.location, '(-90.3690233918754,38.7788148984854)')
FROM status s, personal_data pd, relationship_wanted rw , personal_ethnicity pe , personal_religion pr , personal_bodytype pb
WHERE s.active AND s.status != 0
AND (s.gid = pd.gid AND pd.gender = 0)
AND (s.gid = rw.gid AND rw.gender = 1)
AND geo_distance( pd.location, '(-90.3690233918754,38.7788148984854)' ) <= 75
ORDER BY geo_distance( pd.location, '(-90.3690233918754,38.7788148984854)'), s.created desc;

What's the purpose of joining it with "pb"?

if the proper clause was in place, ooddles of purpose ... it wasn't until
after I upgraded to the newest code that Tom put the fix in for, and it
was *still* causing problems, that I clued into the fact that the AND
clause that was supposed to be associated with 'pb' *wasn't* there ...

For the whole time we were debugging this, none of us clued into it :)