title: Moving from MySQL to to Postgres on Rails 3
body: <p>Aside from removal of some MySQL specific queries, the migration was pretty smooth. The problem now is, that during developement there is a lot more queries to the DB than before.</p>
  
  <pre><code>Started GET "/profiles/data" for 127.0.0.1 at Tue Sep 21 10:26:18 +0200 2010
   Processing by ProfilesController#data as JSON
   User Load (24.3ms)  SELECT "users".* FROM "users" ORDER BY updated_at DESC LIMIT 1
   CACHE (0.0ms)  SELECT "users".* FROM "users" ORDER BY updated_at DESC LIMIT 1
   SQL (10.5ms)   SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
   FROM pg_attribute a LEFT JOIN pg_attrdef d
   ON  a.attrelid = d.adrelid AND a.attnum = d.adnum
   WHERE a.attrelid = '"users"'::regclass
   AND a.attnum &gt; 0 AND NOT a.attisdropped
   ORDER BY a.attnum
  </code></pre>
  
  <p>Every single query results in 3-8 additional queries like the above. What and why is happening? One of the problems now is, that developement.log is bloated and unreadable. I waste loads of time scrolling inbetween those queries looking for the right thing...</p>
  
  <p>Update: Tue Sep 21</p>
  
  <p>This is not related to the query type. All the queries are generating this kind of stuph:</p>
  
  <pre><code>ree-1.8.7-2010.02 &gt; User.first
    SQL (0.3ms)  SHOW client_min_messages
    SQL (2.0ms)  SET client_min_messages TO 'panic'
    SQL (6.3ms)  SET standard_conforming_strings = on
    SQL (18.3ms)  SET client_min_messages TO 'notice'
    SQL (15.6ms)  SET time zone 'UTC'
    SQL (17.2ms)  SHOW TIME ZONE
    SQL (23.8ms)   SELECT tablename FROM pg_tables WHERE schemaname = ANY (current_schemas(false)) 
    User Load (162.4ms)  SELECT "users".* FROM "users" LIMIT 1
    SQL (7.5ms)   SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc,
      a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid
      AND a.attnum = d.adnum WHERE a.attrelid = '"users"'::regclass AND a.attnum &gt; 0 AND
      NOT a.attisdropped ORDER BY a.attnum 
  </code></pre>
  
  <p>[...]
  1 row in set
  ree-1.8.7-2010.02 > </p>