Juergen Posted March 28, 2016 Share Posted March 28, 2016 Hello @ all, I have a general question about how PW deals with db queries. If I query the same db field multiple times on a page, fe the title field, will this field be queried only once or for every appearence on the page. $page->title ...... $page->title ...... ...... $page->title Thanks for you answeres Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 28, 2016 Share Posted March 28, 2016 Even pages are most of the time queried once and after that cached. And their fields are as well only loaded once on first demand of it, as long as it's not autojoin field, which are automatically loaded with the pages native data (id, template, …). 2 Link to comment Share on other sites More sharing options...
Juergen Posted March 28, 2016 Author Share Posted March 28, 2016 Thanks LostKobrakai! This answered my questions. Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 28, 2016 Share Posted March 28, 2016 Essentially the places to look at are Pages::getById and Page::getFieldValue. 1 Link to comment Share on other sites More sharing options...
netcarver Posted March 28, 2016 Share Posted March 28, 2016 Bookmarking: https://processwire.com/blog/posts/making-efficient-use-of-fields-in-processwire/ 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now