On Oct 15, 3:50 am, Nate Wiger <[email protected]> wrote:
> In terms of performance (which looks great so far), does Sequel cache
> index/table information?  I see it doing some describes so I assume
> that's to get the column lists/etc and save them.

You assume correctly.  Sequel caches in the following cases (and maybe
elsewhere too):

* Model associations

  Artist.one_to_many :albums
  a = Artist[1]
  a.albums # get from database
  a.albums # cached
  a.albums(true) # get from database

* Schema information

  DB.schema(:table) # get from database
  DB.schema(:table) # cached
  DB.schema(:table, :reload=>true) # get from database

  # Models call the DB.schema method and cache the
  # processed results, too.

* Dataset columns

  ds = DB[:table]
  ds.columns # get from database
  ds.columns # cached
  ds.columns! # get from database

  # However, you need to be careful:

  ds.filter(:column=>1).columns # get from database
  ds.filter(:column=>1).columns # get from database

  # This is because the filter, like most dataset methods,
  # returns a copy of the dataset.

The adapters also may cache some information.  For example, the
postgres adapter caches primary key and sequence lookups.

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