On Sun, Sep 13, 2009 at 6:01 PM, Jon Bennett <[email protected]> wrote:
>
>> You'd probably be best off creating a view (in the database, not a
>> Cake view) to do this. Off the top of my head, the query would use a
>> self join to grab the most recent record for each client. With proper
>> indexing, it should be fairly efficient.
>
> That seems like overkill to me, it's a simple and common query with a
> little processing of the data. As long as the requests are paginated
> it should never be an issue.
>

Overekill? Sorry, but I can't agree with that. It's just the opposite.
Doing this sort of thing inside any decent database will always beat
doing it in application code. Your suggestions all entail selecting
everything and throwing out what's not needed. That can't be anything
but less efficient. Just because Cake is very handy with a lot of
things doesn't mean that good database practice should be ignored.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to