<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>cfis : Rails and Postgresql - Eliminate Hundreds of Thousands of Queries a Day</title>
    <link>http://cfis.savagexi.com</link>
    <atom:link rel="self" type="application/rss+xml" href="http://cfis.savagexi.com/2008/02/08/rails-and-postgresql-eliminate-hundreds-of-thousands-of-queries-a-day?format=rss"/>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Charlie Savage's Blog</description>
    <item>
      <title>Comment on Rails and Postgresql - Eliminate Hundreds of Thousands of Queries a Day by rick</title>
      <description>&lt;p&gt;Do you have a stack trace for these database calls?  The columns, at least, should be cached if cache_classes is true.  See: &lt;a href="http://dev.rubyonrails.org/browser/trunk/activerecord/lib/active_record/base.rb#L1086" rel="nofollow"&gt;http://dev.rubyonrails.org/browser/trunk/activerecord/lib/active_record/base.rb#L1086&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Are you working with dynamic models or anything like that?&lt;/p&gt;</description>
      <pubDate>Fri, 08 Feb 2008 12:33:17 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:1c46e26a-24e0-49e7-8ae9-70ff232e473d</guid>
      <link>http://cfis.savagexi.com/2008/02/08/rails-and-postgresql-eliminate-hundreds-of-thousands-of-queries-a-day#comment-6242</link>
    </item>
    <item>
      <title>Comment on Rails and Postgresql - Eliminate Hundreds of Thousands of Queries a Day by rick</title>
      <description>&lt;p&gt;try this instead: &lt;a href="http://rubyurl.com/luar" rel="nofollow"&gt;http://rubyurl.com/luar&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 08 Feb 2008 12:33:57 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:e6113bc6-b7fe-4dca-867c-4393867588e0</guid>
      <link>http://cfis.savagexi.com/2008/02/08/rails-and-postgresql-eliminate-hundreds-of-thousands-of-queries-a-day#comment-6243</link>
    </item>
    <item>
      <title>Comment on Rails and Postgresql - Eliminate Hundreds of Thousands of Queries a Day by Charlie</title>
      <description>&lt;p&gt;Hi Rick,&lt;/p&gt;

&lt;p&gt;Ah interesting - I see what you mean.  Did a bit more digging, and it looks like the issues is coming from HasAndBelongsToManyAssociation associations .  I updated the bug report with the stack trace.  I&amp;#8217;m not that familiar with the internal of ActiveRecord, but it looks to me that the column caching code might be better in the base connection adapter class instead of ActiveRecord::Base, which would solve this issue.&lt;/p&gt;</description>
      <pubDate>Fri, 08 Feb 2008 13:05:09 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:0a95a639-aaf0-409f-bcf5-99f9913079c2</guid>
      <link>http://cfis.savagexi.com/2008/02/08/rails-and-postgresql-eliminate-hundreds-of-thousands-of-queries-a-day#comment-6244</link>
    </item>
    <item>
      <title>Comment on Rails and Postgresql - Eliminate Hundreds of Thousands of Queries a Day by Koz</title>
      <description>&lt;p&gt;We also have Base.reset_column_information.&lt;/p&gt;

&lt;p&gt;Perhaps it&amp;#8217;s worth investigating moving all the caching into the adapters for 2.1,  at present the output of Base.inspect will repeatedly query the database too.&lt;/p&gt;</description>
      <pubDate>Fri, 08 Feb 2008 14:04:08 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:87c96e5d-1e32-4808-8f18-071734f0a920</guid>
      <link>http://cfis.savagexi.com/2008/02/08/rails-and-postgresql-eliminate-hundreds-of-thousands-of-queries-a-day#comment-6247</link>
    </item>
    <item>
      <title>Comment on Rails and Postgresql - Eliminate Hundreds of Thousands of Queries a Day by Charlie</title>
      <description>&lt;p&gt;Hi Koz,&lt;/p&gt;

&lt;p&gt;I just took a quick look, and it doesn&amp;#8217;t seem that hard.  I&amp;#8217;d approach it by renaming the various columns methods on the concrete adapters (Postgresql, mysql, etc) to read_columns.  Then I&amp;#8217;d add a columns method on AbstractAdapter which checks a cache, and if nothing is found, calls read_methods.&lt;/p&gt;

&lt;p&gt;It would also be good to remove the column caching on ActiveRecord::Base but there is on hangup - the looping over column names to set the primary key (which only ActiveRecord::Base knows).  Not sure what do about that.&lt;/p&gt;

&lt;p&gt;Anyway, hope this helps.&lt;/p&gt;</description>
      <pubDate>Fri, 08 Feb 2008 15:27:51 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:f35b8fee-fffc-4784-ab0f-4ed86cdda8b2</guid>
      <link>http://cfis.savagexi.com/2008/02/08/rails-and-postgresql-eliminate-hundreds-of-thousands-of-queries-a-day#comment-6254</link>
    </item>
  </channel>
</rss>
