Caching column names


#1

is there a setting/option to ActiveRecord::Base which will cache the
columns
after the first query - rather than querying the database for them each
time?

-a

===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy. all misery
| comes from the desire for oneself to be happy.
| – bodhicaryavatara


#2

Ara.T.Howard wrote:

is there a setting/option to ActiveRecord::Base which will cache the
columns after the first query - rather than querying the database
for them each time?

Sounds like you’re running under Development, not Production…

-Brian


#3

Ara.T.Howard wrote:

is there a setting/option to ActiveRecord::Base which will cache the
columns
after the first query - rather than querying the database for them each
time?

Yes there is, altough you probably dont want to set it explicitly. Just
switch to production enviroment and thats it!

Zsombor


#4

On Dec 8, 2005, at 1:18 PM, Brian V. Hughes wrote:

Ara.T.Howard wrote:

is there a setting/option to ActiveRecord::Base which will cache the
columns after the first query - rather than querying the database
for them each time?

Sounds like you’re running under Development, not Production…

-Brian

No I think Ara is asking about the sql queries being cached so the
next time a .find is called and the object hasn’t changed it will be
served from a cache without hitting the db? And he’s not talking
about page or fragment caching that you can use in production mode.
As far as I know there is nothing in AR yet that caches db queries
but this would be a great addition to keep the level of db activity
from being so chatty. Some certain ways of using AR can result in
tons of queries to the db for each page render and it would be great
if some of these were cached.

The question is how to implement this feature?

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
removed_email_address@domain.invalid


#5

On Dec 8, 2005, at 2:08 PM, Ezra Z. wrote:

-Brian
great if some of these were cached.

The question is how to implement this feature?

Cheers-
-Ezra Z.

Actually I take all of that back ;-) On a second reading of his

question, you guys were right that this is a difference between dev
and production mode. In dev mode the columns are queried every time
because in dev mode you can add a column to your table and rails will
pick it up on the next request. In production mode these are cached
and not issued every time. So yes switching to production mode will
cahce the column name queries in AR.

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
removed_email_address@domain.invalid