How to remove unneccessary SHOW FIELDS FROM?

I see that every time I load a page (that lists paginated rows of a
database), mysql is told to “SHOW FIELDS FROM (database)”.

This seems unneccessary to me. (I know the fields; my code knows
the fields!)

My guess is that this happens because of something that was in the
rails-provided scaffolding, most of which I’ve replaced by now.

Is a way to turn this off? I realize it probably doesn’t take a lot of
time, but it seems inelegant to send needless queries to the database
engine.

On 3/25/07, Dan K. [email protected] wrote:

Is a way to turn this off? I realize it probably doesn’t take a lot of
time, but it seems inelegant to send needless queries to the database
engine.

Actually, your code doesn’t know the fields. Well, ActiveRecord, not
your code. This only happens in development mode when your classes
are reloading (to pick up changes to your schema). In production
mode, the SHOW FIELDS query will be called once at startup.


Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com

Thanks, Rick. I’m still adjusting to this ActiveRecord idea, and what
goes on behind the scenes, and I appreciate the informative reply. Dan.

Just goes to show how invaluable I see this Google Group.

On Mar 25, 1:58 pm, Dan K. [email protected]