Forum: Ruby on Rails caching column names

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 ara.t.howard (Guest)
on 2005-12-08 22:10
(Received via mailing list)
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
===============================================================================
7c4087d053eb02d099a17d91ba5e33b5?d=identicon&s=25 brianvh (Guest)
on 2005-12-08 22:19
(Received via mailing list)
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
15619be638a3ae3d6f86a4995c6484c1?d=identicon&s=25 dee.zsombor (Guest)
on 2005-12-08 22:31
(Received via mailing list)
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
8e44c65ac5b896da534ef2440121c953?d=identicon&s=25 ezra (Guest)
on 2005-12-08 23:16
(Received via mailing list)
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 Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
8e44c65ac5b896da534ef2440121c953?d=identicon&s=25 ezra (Guest)
on 2005-12-08 23:40
(Received via mailing list)
On Dec 8, 2005, at 2:08 PM, Ezra Zygmuntowicz wrote:

>> -Brian
> great if some of these were cached.
>
> 	The question is how to implement this feature?
>
> Cheers-
> -Ezra Zygmuntowicz


	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 Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
This topic is locked and can not be replied to.