Re: Re: adding join conditions with DB_DataObject
| From: | daniel at electroteque dot org | Date: | Sun, 06 Feb 2005 03:08:11 +0000 |
| Subject: | Re: Re: adding join conditions with DB_DataObject | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17407@lists.php.net to get a copy of this message | ||
> Unfortunatly cant be done with joinAdd()
>
> I do this quite alot as mysql doesnt optimize queries if you put the
> condition in the where part, so it can make a huge performance
> difference.
>
> At present the work around is to do something like this (or just write
> to the $this->_join directly):
>
> function joinAddOn($obj,$l,$tbl) {
> $cond = $obj->whereAdd();
> $r = $this->JoinAdd($obj,$l,$tbl);
> if (is_a($r,'PEAR_Error')) {
> return $r;
> }
> $this->_join .= " AND ({$cond})";
> }
>
Speaking of joins, is there any way at all to optimise them ? I'm finding
the generated queries pretty slow than i would with normal sql. I am also
having issues creating an alias for the master table or the master join
table, finding some big issues here. I 'll past some code soon, my farhn
OSX system crashed yesterday.
Dan
(Yes cheap shitty Hitachi HD so they can cash in, I would expect a
professional laptop system to at least have a Barracuda or IBM drive :|)