[TriLUG] Smarty
Kevin Hunter Kesling
hunteke at earlham.edu
Thu Sep 19 13:54:48 EDT 2013
At 1:37pm -0400 Thu, 19 Sep 2013, Brian McCullough wrote:
> On Thu, Sep 19, 2013 at 01:24:12PM -0400, Brian Henning wrote:
>> Can you not limit your database read (i.e. a carefully-crafted
>> WHERE or LIMIT in sql parlance) instead of limiting the iteration
>> afterwards?
>
> I could probably do that. I was trying to re-use an existing
> function call that returns a set of data that would have been useful
> in this case, instead of creating something new.
Understandable. On the other hand (and not knowing the full context of
your project situation), there could be some real utility in telling the
DB the limit of your data needs. Depending on the choices the
underlying DB driver has made, and the general size of your DB, this
could result in a performance win in terms of less unnecessary
pre-caching, less communication with the DB, and different choices by
the DB, and so-on. If your general DB-access is pretty minimal then no
big deal; if this application tends to hit the database pretty hard
(e.g., a heavy traffic site) you could have some big wins.
Similarly, if you can put a hard boundary on the rows returned from the
DB, you will likely have an opportunity for simpler template code.
However, if programmer time-right-now is the biggest concern, looks like
Scott has your back.
Good luck,
Kevin
More information about the TriLUG
mailing list