All good personal,
I had asked another question, but I was able to identify some queries that are consuming a lot of execution time.
I developed a theme for a news portal, and in each area I upload news from a certain category. But since some posts (news) use more than one category, I need to be careful not to get repeated data, in this case I use the post__not_in
See an example:
<?php
//$posts_ID é uma variavel que guarda dos IDs dos posts ja exibidos em consultas anteriores a esta.
$posts_planeta_diario = new WP_Query(
array(
'post__not_in' => $posts_ID,
'posts_per_page' => 3,
'cat' => 3946
)
);
$return_while = 1;
while ($posts_planeta_diario->have_posts()):
$posts_planeta_diario->the_post();
//armazena os IDs resgatados
$posts_ID[] = get_the_ID();
//evitar quebra de layout
if ($return_while == 3)
$style_planeta_diario = 'style="margin-right:0px"'
?>
<li class="liNoticiasPlanetaDiario02" <?php echo $style_planeta_diario; ?>>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumb-205x145') ?></a>
<article>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</article>
</li>
<?php
$return_while ++;
endwhile;
?>
This example demonstrates what happens on the home page of the site. My database currently has 1gb. When I have many simultaneous accesses of that famous database error (ERROR WHEN CONNECTING TO THE DATABASE).
The logic I used above is correct, can this type of call be causing slowness and bank error?