Hi Jeremy

Thank you for your answers.

> To take an example from [1]:
>
>   ds = DB[:items].filter(:name=>:$n)
>   ds.call(:select, :n=>'Jim')
>
> Here :$n is used as the placeholder, and :n is used to provide the
> value of the placeholder.  I guess I'm not clear on what is confusing
> you.

Does :n come from :$n? OK, I think so. But what is :name for? The
column name?

> Actually, it wouldn't be able to do so in an unambiguous manner except
> in very simple cases, and even though it would a major effort to try
> to support.  In a Model, Sequel knows exactly what the columns are for
> the model's backing table.  There is no such knowledge with datasets.

Perfect! I implemented it using models! Isn't it already able to guess
the column types? Or does this feature need to be implemented yet?

> Note that you should only be attempting to use bound variables and
> prepared statements if you have identified a bottleneck in your
> application that you think preparing will speed up.  Generally, only
> queries that are complex for the database to plan stand much benefit
> from preparing, and those queries tend to be the most complex ones.
> Using bound variables and prepared statements for simple queries in
> Sequel is usually slower than just embedding the value in the SQL
> string.  I've done benchmarking on this on PostgreSQL, if you are
> interested [2].

The application which I use the prepared statement is a log parser
which saves the DHCP packets into a database table (live). And as I
said in the mail, it's a huge amount of logs constantly arriving. The
prepared statement already *greatly* improved the performance!
(Everything it does is an INSERT for each parsed DHCP packet with all
columns set into one single table, which is always the same. The
associated objects of the other models are saved without prepared
statement, because they're much fewer.)

Paddor

-- 
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