Re: Help to improve MySQL query
| From: | Dee Ayy | Date: | Mon, 11 Aug 2008 14:41:56 +0000 |
| Subject: | Re: Help to improve MySQL query | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-45198@lists.php.net to get a copy of this message | ||
On Sat, Aug 9, 2008 at 1:32 AM, Niel Archer <not@chance.now> wrote:
> Hi
>
> You do not say how you identify the last call (there is no date/time
> field for example), so a complete answer is not really possible
With the "id (auto incremented int)", the last record of either table
would be the largest id in a particular group.
> Do not use "NOT LIKE 'Completed'", it's an inefficient way of doing
> "!=
> 'Completed'"
I'll modify that as you said.
My real concern is that $theHugeListOfIncidentIds keeps growing and is
used in the "Calls.id IN ($theHugeListOfIncidentIds)".
Even if the $theHugeListOfIncidentIds was replaced with an actual
MySQL query instead of first being processed by PHP, I think that is a
bad approach (but maybe that is the solution if I only change this
query and do not change/add columns or states).