Jump to content

Recommended Posts

Posted

Currently doing some cleanup on that very same project (Pretty close to launch and excited about it!) and that includes doing a little bit of optimization.

For that reason i'm trying to minimize my PDO requests as well as image quality and such, but i'll work on it an issue at a time.

Now I have this loop that takes a bunch of pages, modifies a value (In example: views) and then saves them again, before showing some of their content. Now this is something that I have to do for every page load on every page, it's a major feature of the site.

Going through my queries I realize that for each one of these there's at least 3 queries that occur over and over again:

  1. We get the page.
  2. We modify the value.
  3. We save that page's field.

I am doing this about 10 times a page, so the queries quickly stack up. I managed to get the first point down by getting all my required pages in a single swoop (a single albeit specific $pages->find).

For step 2 I realize I do have to go and individually modify the value for each page, so what i'm asking here is:

Once I have an array with all of my modified pages, is there a way I can save that same field in all of them at the same time? It would definitely be nice to decrease my queries by 9 or so through this method.

Thanks in advance for any help you can provide.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...