disabling/cachine SHOW FIELDS FROM

I ask if this is possible with hopes I can squeeze every last ounce of optimization from my database(s).

Is there any way to tell rails to cache or not inspect tables with all of these “SHOW FIELDS FROM” queries?

I’ve searched around but haven’t come up with anything concrete. Anyone have any tips?

  • J

I ask if this is possible with hopes I can squeeze every last ounce of optimization from my database(s). Is there any way to tell rails to cache or not inspect tables with all of these "SHOW FIELDS FROM" queries? I've searched around but haven't come up with anything concrete. Anyone have any tips?

How about running rails in production mode?

Regards, Rimantas

Rimantas -

Pardon my ignorance, but when in production mode it does NOT make those queries? Could you point me to where in the docs this is specified? Some colleagues of mine were wondering the same issue and I’d like to point them somewhere.

Thanks for the reply.

  • Joel

Rimantas -

Pardon my ignorance, but when in production mode it does NOT make those queries?

It does, but only once, on initial load. In development mode your model classes get reloaded on every request.

Could you point me to where in the docs this is specified? Some colleagues of mine were wondering the same issue and I'd like to point them somewhere.

Not sure if this is the best place fot this, but take a look at config/environments/development.rb and config/environments/production.rb

development.rb:

# In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.cache_classes = false

production.rb: # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true

Regards, Rimantas