# How to remove unneccessary SHOW FIELDS FROM?

**URL:** <https://www.ruby-forum.com/t/how-to-remove-unneccessary-show-fields-from/90039>\
**Category:** Rails\
**Created:** [March 25, 2007, 12:54pm UTC](https://www.ruby-forum.com/t/how-to-remove-unneccessary-show-fields-from/90039 "2007-03-25T12:54:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [March 25, 2007, 12:54pm UTC](https://www.ruby-forum.com/t/how-to-remove-unneccessary-show-fields-from/90039/1 "2007-03-25T12:54:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [March 25, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/how-to-remove-unneccessary-show-fields-from/90039/2 "2007-03-25T13:23:02Z")

</div>

On 3/25/07, Dan K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [March 25, 2007, 2:58pm UTC](https://www.ruby-forum.com/t/how-to-remove-unneccessary-show-fields-from/90039/3 "2007-03-25T14:58:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [March 26, 2007, 10:37pm UTC](https://www.ruby-forum.com/t/how-to-remove-unneccessary-show-fields-from/90039/4 "2007-03-26T22:37:37Z")

</div>

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

On Mar 25, 1:58 pm, Dan K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
