On Tuesday, November 6, 2012 7:59:44 AM UTC-8, JD wrote: > > Hi, > > Our team has just started down the path of replacing the ActiveRecord gem > with Sequel for our project. We are currently using a Teradata database, > and as such have had to create a few minor extensions to get things working > correctly (creating a JDBC::Teradata::Dataset class to house extensions). > Things seem to be working well so far, however we have noticed that every > time we initialize a model, it appears to execute the exact same query > twice while fetching metadata, before executing our actual queries. We > have occasional problems with latency in our environment, so we are trying > to do anything we can to reduce the number of calls. Any insight would be > helpful - thanks in advance! >
First, it looks like you aren't quoting identifiers in your database. I'm assuming you disabled that on purpose, maybe because :'db_name.table_def' wouldn't work without it? In Sequel, it's recommend that you specify qualified identifiers with the double underscore notation: :db_name__table_def, which should work whether or not you are quoting identifiers. This might also be affecting your duplicate queries issue. You could use the schema_caching extension to cache the schema, so Sequel doesn't need to parse it from the database every time. Of course, you need to be sure to update the cache when the database schema actually changes. This also depends on Sequel supporting schema parsing for the database. Assuming that the JDBC Teradata adapter implements the JDBC metadata methods, schema parsing should work (try DB.schema(:db_name__table_def) to make sure). Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/v81z3_ZMZbYJ. 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.
