[Jeffrey W. Baker - Thu at 06:56:59PM -0700]
> > explain select c.id from c join b on c_id=c.id  group by c.id order by c.id
> > desc limit 5;
> Where's b in this join clause?

"join b on c_id=c.id"

It just a funny way of writing:

select c.id from c,b where c_id=c.id  group by c.id order by c.id desc limit 5;

> It looks like a cartesian product to me.

No.  The query will return exactly the same as the simplest query:

  select c.id from c order by c.id  desc limit 5;   

As said, this is a gross oversimplification of the production envorinment.
In the production environment, I really need to use both join, group and
limit.  I tested a bit with subqueries, it was not a good solution
(selecting really a lot of rows and aggregates from many of the tables).

The next idea is to hack it up by manually finding out where the "limit"
will cut, and place a restriction in the where-part of the query.

Notice of Confidentiality: This information may be confidential, and
blah-blah-blah - so please keep your eyes closed.  Please delete and destroy
this email.  Failure to comply will cause my lawyer to yawn.

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to