Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You may benefit from a simpler naming scheme for your memcached keys - so they are easier to delete. Seems like with the MD5 solution, you might be creating too many keys for things which generally show the same data.</p> <p>You might also consider a shorter cache time, like 20 minutes?</p> <p>Also - how many items per page are you retrieving for each of these search result pages? If you have a paginated search - getting 50 items from the server shouldn't be too intensive.</p> <p>You may have tuned the mysql server, but have you tuned the queries (improving them by examining the EXPLAIN output), or table structures (by adding useful indexes)?</p> <p>I'm also wondering how intense the queries on those pages are. Do you join several tables? You may benefit from doing a simpler query - or a few queries (outlined below).</p> <p>Alternatively - For each row in the result, do you run another query - or several? You may benefit from a slightly more complex search query that avoids you having to do the nested queries. Or, are you being bitten by an ORM library which does the same thing, runs a search, then queries for sub items on each iteration?</p> <p>The 'a few simpler queries' solution - say for example - if you've got an item, and want to know it's category in the result set...</p> <p>In stead of this:</p> <pre><code>SELECT i.id, i.name, c.category FROM items AS i INNER JOIN categories AS c ON i.category_id = c.id; </code></pre> <p>This is a simple example - but say there were categories, and several other JOINs involved.</p> <p>You might go this route:</p> <pre><code>// run this query SELECT id, category FROM categories - and put that into a keyed array. // then in PHP create an array keyed by the id $categories = array(); while ( false !== ( $row = mysql_fetch_assoc ( $result ) ) ) { $categories[ $row['id'] ] = $row['category']; } // and so on $types = array(); // ... // etc. </code></pre> <p>Then do your search but without all of the JOINS, just from the items table with your where clauses, and in the output say...</p> <pre><code>&lt;?php foreach($items as $item): ?&gt; &lt;h4&gt;&lt;?php echo $item['name']; ?&gt;&lt;/h4&gt; &lt;p&gt;Category: &lt;?php echo $categories[ $item['category_id'] ]; ?&gt;&lt;/p&gt; &lt;p&gt;Type: &lt;?php echo $types[ $item['type_id'] ]; ?&gt;&lt;/p&gt; &lt;!-- and so on --&gt; &lt;?php endforeach; ?&gt; </code></pre> <p>It's a little ghetto, but maybe this - and the other suggestions - will help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload