Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] [OT]: PHP/MySQL: Japanese input/ouput prgramming advice docs sought



>>>>> "Jean-Christian" == Jean-Christian Imbeault <jean_christian@example.com> writes:

    >> Unless your app returns lots of data via cursors, it's
    >> preferable to sort client-side anyway.

    Jean-Christian> Is this comment specifically for Postgress? I
    Jean-Christian> always tought it was more efficient to get a DB to
    Jean-Christian> sort results than doing it programmatically.

First, I'm not talking about efficiency.  I'm thinking locale-specific
issues; normally you will not be able to request a locale-specific
sort from the DB, it will have a global locale.  In particular this is
true of Postgres as of the 7.0 betas (I haven't paid attention since).
Maybe you don't need that today, but are you sure you won't tomorrow?

Even for efficiency, it's the other way around, except for the
important special case that the DB may be keeping things in order,
already.  (This happens as a side effect of indexing techniques such
as binary search.)  True, the DB will use a highly optimized general
purpose sort routine, but you can probably do nearly as well, even in
a scripting language (they all have efficient general sort routines in
their libraries).  However, you may have information that makes
sorting a lot faster (eg, transform a large array of postal code
strings to 7-place integers, then sort, then translate back---much
faster than doing string comparisons).  Furthermore, there are sorting
jobs that the DB simply won't be able to do, such as 50-on-jun from
kanji (of course, you can keep the yomi in the database, but what if
you didn't?)

Finally, there's an issue of cost.  Clients are cheap, and typically
spend most of their cycles on screen savers.  Sort there if possible,
especially if owned by someone else ;-).  Webservers are moderately
expensive, but costs scale linearly because web service distributes
well over a farm of identical boxen.  Database servers are even more
expensive, and costs scale badly because to get 10x the power you need
10x the machine---general relational databases do not distribute well
(although LDAP does).

-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
 My nostalgia for Icon makes me forget about any of the bad things.  I don't
have much nostalgia for Perl, so its faults I remember.  Scott Gilbert c.l.py


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links