Jeff AA writes:
> An advantage of the session/id is that you end up with stateful query
> instances,

Stateful instances are also problematic.  You have essentially two
paths through the code: first time and subsequent time.  If you write
the code statelessly, there is only one path.  Fewer bugs, smaller
code, less development.

Sessions are caches.  Add them only when you know you need them.

> and can remember [at least for a short period!] the total
> number of items, so that you can say 'Results 1 to 10 of 34,566' without
> having to count all results every time.

Maybe this is just because we are using Oracle, but if you do a query:

    SELECT count(*) FROM bla, bla...

followed up by:

    SELECT field1, field2, ... FROM bla, bla...

Oracle will cache the query compilation and results so it is very fast
(basically a round-trip to database server) for the second query.
We execute these two queries on every paged list on every request.

One of the advantages of a declarative OR mapping is that you can do
things like sort to select asfields and order queries consistently.
Oracle takes advantage of this.  I don't know of mySQL or Postgres do,
too, but they probably will someday.

It's a bit slow (seconds) with Oracle's Context engine, which we've
been considering replacing.  Most of our queries are not text searches
iwc Oracle queries take less than 20ms per query.

We're not a large site (peak 50K views/day), and we have enough
hardware (two front ends, two middle tier, one db).  Our smaller sites
(e.g. bivio.biz) run on minimal hardware and use Postgres.  They use
the same code, and it seems to work fine.

Rob


Reply via email to