# All Indexes being configured on every page load (seemingly)

**URL:** <https://www.ruby-forum.com/t/all-indexes-being-configured-on-every-page-load-seemingly/155397>\
**Category:** Ferret\
**Created:** [December 11, 2008, 12:47pm UTC](https://www.ruby-forum.com/t/all-indexes-being-configured-on-every-page-load-seemingly/155397 "2008-12-11T12:47:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [December 11, 2008, 12:47pm UTC](https://www.ruby-forum.com/t/all-indexes-being-configured-on-every-page-load-seemingly/155397/1 "2008-12-11T12:47:54Z")

</div>

Hi - i’m doing some DB optimisations on our site, mainly by watching the  
log files (in dev mode) and seeing what db access is going on. I’m  
seeing a lot of massive outputs like below - this is for one of my  
ferret-indexed classes, but i have 5, and they all seem to output all  
this stuff on every page that loads something from one of those tables  
(just loading, not even updating).

I’m just wondering -  
a) is this normal?  
b) Is it really reconfiguring all my ferret indexes every time i load a  
page?  
c) is it necessary?  
d) is it harming my site’s performance?

thanks, max

SQL (0.001301) SHOW TABLES  
configured index for class Lesson:  
{:user\_default\_field=\>nil, :enabled=\>true,  
:fields=\>{:property\_names=\>{}, :asset\_count=\>{:index=\>:untokenized},  
:asset\_paths=\>{}, :resource\_property\_names=\>{},  
:description\_for\_sort=\>{:index=\>:untokenized}, :user\_login=\>{},  
:name=\>{}, :created\_at\_for\_sort=\>{:index=\>:untokenized},  
:officialness=\>{}, :asset\_names=\>{}, :description=\>{},  
:name\_for\_sort=\>{:index=\>:untokenized}, :user\_name=\>{}},  
:store\_class\_name=\>true,  
:index\_dir=\>"/home/max/work/e\_learning\_resource/trunk/index/development/lesson",  
:mysql\_fast\_batches=\>true, :name=\>:lesson, :single\_index=\>false,  
:index\_base\_dir=\>"/home/max/work/e\_learning\_resource/trunk/index/development/lesson",  
:reindex\_batch\_size=\>1000, :registered\_models=\>[Lesson(id: integer,  
name: string, description: text, user\_id: integer, created\_at: datetime,  
privacy: integer, is\_official: boolean, is\_readonly: boolean,  
comments\_allowed: boolean, hours: integer, sessions: integer,  
updated\_at: datetime)],  
:ferret=\>{:path=\>"/home/max/work/e\_learning\_resource/trunk/index/development/lesson",  
:auto\_flush=\>true, :or\_default=\>false, :key=\>[:id, :class\_name],  
:handle\_parse\_errors=\>true, :create\_if\_missing=\>true,  
:default\_field=\>[:property\_names, :asset\_paths,  
:resource\_property\_names, :name, :user\_login, :officialness,  
:description, :asset\_names, :user\_name]}, :raise\_drb\_errors=\>false,  
:ferret\_fields=\>{:property\_names=\>{:highlight=\>:yes, :store=\>:no,  
:term\_vector=\>:with\_positions\_offsets, :index=\>:yes,  
:via=\>:property\_names, :boost=\>1.0}, :asset\_paths=\>{:highlight=\>:yes,  
:store=\>:no, :term\_vector=\>:with\_positions\_offsets, :index=\>:yes,  
:via=\>:asset\_paths, :boost=\>1.0}, :asset\_count=\>{:highlight=\>:yes,  
:store=\>:no, :term\_vector=\>:with\_positions\_offsets,  
:index=\>:untokenized, :via=\>:asset\_count, :boost=\>1.0},  
:resource\_property\_names=\>{:highlight=\>:yes, :store=\>:no,  
:term\_vector=\>:with\_positions\_offsets, :index=\>:yes,  
:via=\>:resource\_property\_names, :boost=\>1.0},  
:description\_for\_sort=\>{:highlight=\>:yes, :store=\>:no,  
:term\_vector=\>:with\_positions\_offsets, :index=\>:untokenized,  
:via=\>:description\_for\_sort, :boost=\>1.0}, :name=\>{:highlight=\>:yes,  
:store=\>:no, :term\_vector=\>:with\_positions\_offsets, :index=\>:yes,  
:via=\>:name, :boost=\>1.0}, :user\_login=\>{:highlight=\>:yes, :store=\>:no,  
:term\_vector=\>:with\_positions\_offsets, :index=\>:yes, :via=\>:user\_login,  
:boost=\>1.0}, :created\_at\_for\_sort=\>{:highlight=\>:yes, :store=\>:no,  
:term\_vector=\>:with\_positions\_offsets, :index=\>:untokenized,  
:via=\>:created\_at\_for\_sort, :boost=\>1.0},  
:officialness=\>{:highlight=\>:yes, :store=\>:no,  
:term\_vector=\>:with\_positions\_offsets, :index=\>:yes,  
:via=\>:officialness, :boost=\>1.0}, :description=\>{:highlight=\>:yes,  
:store=\>:no, :term\_vector=\>:with\_positions\_offsets, :index=\>:yes,  
:via=\>:description, :boost=\>1.0}, :asset\_names=\>{:highlight=\>:yes,  
:store=\>:no, :term\_vector=\>:with\_positions\_offsets, :index=\>:yes,  
:via=\>:asset\_names, :boost=\>1.0}, :user\_name=\>{:highlight=\>:yes,  
:store=\>:no, :term\_vector=\>:with\_positions\_offsets, :index=\>:yes,  
:via=\>:user\_name, :boost=\>1.0}, :name\_for\_sort=\>{:highlight=\>:yes,  
:store=\>:no, :term\_vector=\>:with\_positions\_offsets,  
:index=\>:untokenized, :via=\>:name\_for\_sort, :boost=\>1.0}}}

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [December 11, 2008, 2:04pm UTC](https://www.ruby-forum.com/t/all-indexes-being-configured-on-every-page-load-seemingly/155397/2 "2008-12-11T14:04:46Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi!

On 11.12.2008, at 12:47, Max W. wrote:

> Hi - i’m doing some DB optimisations on our site, mainly by watching  
> the  
> log files (in dev mode) and seeing what db access is going on. I’m  
> seeing a lot of massive outputs like below - this is for one of my  
> ferret-indexed classes, but i have 5, and they all seem to output all  
> this stuff on every page that loads something from one of those tables  
> (just loading, not even updating).
> 
> I’m just wondering -  
> a) is this normal?

yes, in development mode it is. You shouldn’t see this in production.

> b) Is it really reconfiguring all my ferret indexes every time i  
> load a  
> page?

yep. I think the biggest problem is the noisy output in this case,  
which really makes log files hard to read. You can easily comment out  
the debug statement responsible for this, it’s around line 94 in  
act\_methods.rb.

> c) is it necessary?

It’s a side effect of Rails reloading class definitions on each  
request in dev mode, maybe there would be a way for aaf to work around  
this. However I think this would lead to unexpected behaviour i.e. if  
you modified some aaf option in dev mode and the change would only be  
picked up by restarting the server.

> d) is it harming my site’s performance?

If you’re running in production mode this will happen only once at  
application startup, so the answer is no.

Cheers,  
Jens

* * *

Jens Krämer  
Finkenlust 14, 06449 Aschersleben, Germany  
VAT Id DE251962952  
[http://www.jkraemer.net/](http://www.jkraemer.net/) - Blog  
[http://www.omdb.org/](http://www.omdb.org/) - The new free film database

GPG public key:  
[http://www.jkraemer.net/static/keys/jk\_jkraemer.net.key.asc](http://www.jkraemer.net/static/keys/jk_jkraemer.net.key.asc)

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAklBCCsACgkQgpXMPm7s2942UQCfeVWnVE9Ae8WV52akrwjCKo7H  
7cUAn3urNNNdxVDvO79NXuyU+vgoDUCD  
=XfXl  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [December 11, 2008, 2:54pm UTC](https://www.ruby-forum.com/t/all-indexes-being-configured-on-every-page-load-seemingly/155397/3 "2008-12-11T14:54:00Z")

</div>

Ah, i see, that makes sense. I forgot about the class-reloading stuff  
(even though i habitually make a change to a class and reload the page  
to see it, while in dev mode).

Thanks Jens!  
max
