On Nov 11, 5:28 pm, Hongli Lai <[EMAIL PROTECTED]> wrote:
> russm wrote:
> > this is just about the most wrong test you could have run.
> > the major
>
> Good to know that I was wrong, but the thing is there's practically no
> documentation on how a "good" prepared statement is supposed to look like.

It really depends on the application.  The more work the database has
to do to in the query planner, the more preparing the statement will
help if you have to run it multiple times.

Preparing all statements is a bad idea, and that is probably why your
implementation was slower on the ActiveRecord tests.  With Sequel, a
prepared statement is an explicit choice, Sequel never creates one
behind your back.  There is actually no LRU prepared statement cache,
or even a way to deallocate prepared statements (because of the
connection pool, it would be tricky to implement).   I haven't heard
any complaints about it yet, but if you create too many prepared
statements and go over the limit your database supports, you will have
problems.

> > speed advantage to prepared statements is that they only get planned
> > once. an insert requires essentially no planning, so there's no
> > benefit. try running your test again with a complex select that join
> > 10 tables but returns only a couple of rows and see the advantage.
>
> So are there any good benchmark suites out there? I can come up with an
> insanely complex SQL query if I take the time, but it'll be totally
> disconnected with real-world SQL usage.

As mentioned above, it really depends on the application.  You
shouldn't really pay attention to artificial benchmarks.  If your app
is slower than you would like, profile it and see where it is slow,
then optimize those parts.  If the slow part is in the database query
itself, prepared statements are one tool at your disposal.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to