Yii Framework Forum: What's with the PRAGMA queries? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

What's with the PRAGMA queries? Rate Topic: -----

#1 User is offline   Sander 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 169
  • Joined: 03-November 09
  • Location:Amsterdam, Netherlands

  Posted 05 November 2009 - 03:53 AM

I see that (at least when using SQLite as a DB backend) Yii makes a lot of PRAGMA queries, typically 2 per model (table_info and foreign_key_list). I have a rather complex set of models, and it's not uncommon for some of my pages to be going through 4 or 5 related models to find some piece of information. That could mean 10 additional queries per pageview. Since this information will be mostly static after the initial development phase, is there any way to disable these queries (for example, by statically defining the column lists and primary keys of these tables in the models)?
0

#2 User is offline   sebas 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 496
  • Joined: 28-October 08
  • Location:Buenos Aires, Argentina

Posted 06 November 2009 - 09:50 AM

View PostSander, on 05 November 2009 - 03:53 AM, said:

I see that (at least when using SQLite as a DB backend) Yii makes a lot of PRAGMA queries, typically 2 per model (table_info and foreign_key_list). I have a rather complex set of models, and it's not uncommon for some of my pages to be going through 4 or 5 related models to find some piece of information. That could mean 10 additional queries per pageview. Since this information will be mostly static after the initial development phase, is there any way to disable these queries (for example, by statically defining the column lists and primary keys of these tables in the models)?


You can add a cache method for this to not have to change anything.

See here for more information:

http://www.yiiframew...aching.overview

I recommend to use text files for this...

you should add schemaCaching in your db configuration
0

#3 User is offline   Sander 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 169
  • Joined: 03-November 09
  • Location:Amsterdam, Netherlands

Posted 06 November 2009 - 10:16 AM

View Postsebas, on 06 November 2009 - 09:50 AM, said:

You can add a cache method for this to not have to change anything.

See here for more information:

http://www.yiiframew...aching.overview

I recommend to use text files for this...

you should add schemaCaching in your db configuration


Thanks, that worked. Though I still think it's not really necessary to do any dynamic lookup for this whatsoever when the app is in production, since my table structure will remain completely static after development.. It would save some performance if one could (optionally) define this information in the model.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users