<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Conteúdos sobre SQL | Pink and Brain</title>
	<atom:link href="https://www.pinkandbrain.com/conteudos-sobre/sql/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.pinkandbrain.com/conteudos-sobre/sql/</link>
	<description>Ratos do Desenvolvimento Web, SEO e aquisição, propulsores de estratégias eficientes de marketing digital que geram vantagem competitiva.</description>
	<lastBuildDate>Wed, 18 Jun 2025 19:10:48 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.pinkandbrain.com/wp-content/uploads/2024/10/cropped-favicon-180x180-1-386x386.png</url>
	<title>Conteúdos sobre SQL | Pink and Brain</title>
	<link>https://www.pinkandbrain.com/conteudos-sobre/sql/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Saiba como limpar e otimizar o banco de dados de sites WordPress</title>
		<link>https://www.pinkandbrain.com/saiba-como-limpar-e-otimizar-o-banco-de-dados-de-sites-wordpress/</link>
		
		<dc:creator><![CDATA[César Canteiro]]></dc:creator>
		<pubDate>Fri, 13 Jun 2025 18:37:56 +0000</pubDate>
				<category><![CDATA[Desenvolvimento web]]></category>
		<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Armazenamento em cache]]></category>
		<category><![CDATA[Desenvolvimento Web]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://www.pinkandbrain.com/?p=14619</guid>

					<description><![CDATA[<p>Confira nossas dicas essenciais com hacks para manter seu WordPress funcionando de forma enxuta e rápida</p>
<p>O post <a href="https://www.pinkandbrain.com/saiba-como-limpar-e-otimizar-o-banco-de-dados-de-sites-wordpress/">Saiba como limpar e otimizar o banco de dados de sites WordPress</a> apareceu primeiro em <a href="https://www.pinkandbrain.com">Pink and Brain</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Manter o banco de dados do <strong>WordPress</strong> limpo e otimizado melhora a <strong>velocidade, desempenho e eficiência</strong> do site. O excesso de dados acumulados pode <strong>tornar as consultas lentas</strong>, aumentando o tempo de carregamento das páginas para o usuário que acessar e também para quem edita internamente as páginas, os editores e administradores.</p>



<p>Aqui na Pink and Brain somos ratos quando o assunto é desenvolvimento de sites em WordPress. Confira nossas dicas essenciais com <strong>hacks</strong> para manter seu WordPress funcionando <strong>de forma enxuta e rápida</strong>.</p>



<h2 class="wp-block-heading">Antes de tudo: faça um backup!</h2>



<p><strong>Antes de realizar qualquer alteração no banco de dados, faça um backup completo</strong> usando plugins como:</p>



<ul class="wp-block-list">
<li><strong>UpdraftPlus</strong> (fácil de restaurar)</li>



<li><strong>WPvivid Backup</strong></li>



<li><strong>Duplicator</strong> (ideal para migrações)</li>



<li><strong>phpMyAdmin</strong> (backup manual via exportação)</li>
</ul>



<p>Se for fazer de forma manual, basta você entrar no phpMyAdmin e clicar aqui:</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-full"><img decoding="async" width="1355" height="603" loading="lazy" data-id="14655" src="https://www.pinkandbrain.com/wp-content/uploads/2025/05/phpmyadmin-banco-de-dados-php-wordpress.webp" alt="" class="wp-image-14655" srcset="https://www.pinkandbrain.com/wp-content/uploads/2025/05/phpmyadmin-banco-de-dados-php-wordpress.webp 1355w, https://www.pinkandbrain.com/wp-content/uploads/2025/05/phpmyadmin-banco-de-dados-php-wordpress-150x67.webp 150w" sizes="auto, (max-width: 1355px) 100vw, 1355px" title="phpmyadmin banco de dados php wordpress"></figure>
</figure>



<p>Se algo der errado, <strong>você pode restaurar seu site rapidamente!</strong> 🛠️</p>



<h2 class="wp-block-heading">Hacks para limpar o banco de dados</h2>



<h3 class="wp-block-heading">Remova transientes expirados</h3>



<p>Transientes são dados temporários salvos no banco de dados para acelerar carregamentos. Quando expiram, <strong>continuam ocupando espaço</strong>. Remova transientes antigos com:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Hack" style="font-size:.875rem;font-family:Code-Pro-Hack,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">SQL</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>DELETE FROM wp_options WHERE option_name LIKE ‘_transient_%’ OR option_name LIKE ‘_site_transient_%’;</textarea><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewbox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">DELETE</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">FROM</span><span style="color: #D4D4D4"> wp_options </span><span style="color: #569CD6">WHERE</span><span style="color: #D4D4D4"> option_name </span><span style="color: #569CD6">LIKE</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">'_transient_%'</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">OR</span><span style="color: #D4D4D4"> option_name </span><span style="color: #569CD6">LIKE</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">'_site_transient_%'</span><span style="color: #D4D4D4">;</span></span></code></pre><span style="display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative">SQL</span></div>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-full"><img decoding="async" width="1255" height="610" loading="lazy" data-id="14656" src="https://www.pinkandbrain.com/wp-content/uploads/2025/05/limpar-transient-bando-my-sql.webp" alt="" class="wp-image-14656" srcset="https://www.pinkandbrain.com/wp-content/uploads/2025/05/limpar-transient-bando-my-sql.webp 1255w, https://www.pinkandbrain.com/wp-content/uploads/2025/05/limpar-transient-bando-my-sql-150x73.webp 150w" sizes="auto, (max-width: 1255px) 100vw, 1255px" title="Limpar transient banco my sql"></figure>
</figure>



<p>Você pode <strong>simular as queries antes de executar</strong>. Cuidado porque depois que executar não dá para voltar!</p>



<h3 class="wp-block-heading">Limpe revisões antigas de postagens</h3>



<p>Cada vez que você edita um post, <strong>o WordPress salva uma revisão</strong>. Com o tempo, isso <strong>acumula centenas de versões</strong>, tornando o banco de dados pesado.</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Hack" style="font-size:.875rem;font-family:Code-Pro-Hack,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">SQL</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>DELETE FROM wp_posts WHERE post_type = ‘revision’;</textarea><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewbox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">DELETE</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">FROM</span><span style="color: #D4D4D4"> wp_posts </span><span style="color: #569CD6">WHERE</span><span style="color: #D4D4D4"> post_type = </span><span style="color: #CE9178">'revision'</span><span style="color: #D4D4D4">;</span></span></code></pre><span style="display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative">SQL</span></div>



<p><strong>Dica extra</strong>: Você pode limitar a quantidade de revisões que o WordPress guarda:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Hack" style="font-size:.875rem;font-family:Code-Pro-Hack,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">PHP</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>define(‘WP_POST_REVISIONS’, 5);</textarea><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewbox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">define</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">'WP_POST_REVISIONS'</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">5</span><span style="color: #D4D4D4">);</span></span></code></pre><span style="display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative">PHP</span></div>



<p>Isso mantém <strong>apenas as últimas cinco revisões</strong>, reduzindo o excesso de dados.</p>



<h3 class="wp-block-heading">Exclua rascunhos automáticos</h3>



<p>O WordPress salva automaticamente rascunhos não publicados. Para remover todos os rascunhos não utilizados:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Hack" style="font-size:.875rem;font-family:Code-Pro-Hack,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">SQL</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>DELETE FROM wp_posts WHERE post_status = ‘auto-draft’;</textarea><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewbox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">DELETE</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">FROM</span><span style="color: #D4D4D4"> wp_posts </span><span style="color: #569CD6">WHERE</span><span style="color: #D4D4D4"> post_status = </span><span style="color: #CE9178">'auto-draft'</span><span style="color: #D4D4D4">;</span></span></code></pre><span style="display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative">SQL</span></div>



<h3 class="wp-block-heading">Limpe comentários de spam e lixo</h3>



<p>Se seu site recebe muitos comentários, <strong>o banco de dados pode estar cheio de mensagens de spam</strong>. Remova comentários não aprovados e na lixeira:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Hack" style="font-size:.875rem;font-family:Code-Pro-Hack,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">SQL</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>DELETE FROM wp_comments WHERE comment_approved = ‘spam’ OR comment_approved = ‘trash’;</textarea><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewbox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">DELETE</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">FROM</span><span style="color: #D4D4D4"> wp_comments </span><span style="color: #569CD6">WHERE</span><span style="color: #D4D4D4"> comment_approved = </span><span style="color: #CE9178">'spam'</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">OR</span><span style="color: #D4D4D4"> comment_approved = </span><span style="color: #CE9178">'trash'</span><span style="color: #D4D4D4">;</span></span></code></pre><span style="display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative">SQL</span></div>



<p><strong>Dica extra</strong>: Instale o <strong>Akismet</strong> ou <strong>Antispam Bee</strong> para filtrar comentários antes que eles sejam salvos no banco de dados.</p>



<h3 class="wp-block-heading">Remova metadados órfãos de posts</h3>



<p>Cada post pode ter metadados extras salvos, como imagens destacadas, configurações de SEO, entre outros. Se um post for apagado, <strong>os metadados ficam sem referência</strong>, ocupando espaço no banco de dados.</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Hack" style="font-size:.875rem;font-family:Code-Pro-Hack,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">SQL</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>DELETE pm FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL;</textarea><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewbox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">DELETE</span><span style="color: #D4D4D4"> pm </span><span style="color: #569CD6">FROM</span><span style="color: #D4D4D4"> wp_postmeta pm</span></span>
<span class="line"><span style="color: #569CD6">LEFT JOIN</span><span style="color: #D4D4D4"> wp_posts wp </span><span style="color: #569CD6">ON</span><span style="color: #D4D4D4"> wp.ID = pm.post_id</span></span>
<span class="line"><span style="color: #569CD6">WHERE</span><span style="color: #D4D4D4"> wp.ID </span><span style="color: #569CD6">IS</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">NULL</span><span style="color: #D4D4D4">;</span></span></code></pre><span style="display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative">SQL</span></div>



<h3 class="wp-block-heading">Remova metadados órfãos de usuários</h3>



<p>Usuários deletados <strong>deixam registros inúteis</strong> no banco de dados. Limpe dados que não têm mais referência:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Hack" style="font-size:.875rem;font-family:Code-Pro-Hack,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">SQL</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>DELETE um FROM wp_usermeta um
LEFT JOIN wp_users wu ON wu.ID = um.user_id
WHERE wu.ID IS NULL;</textarea><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewbox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">DELETE</span><span style="color: #D4D4D4"> um </span><span style="color: #569CD6">FROM</span><span style="color: #D4D4D4"> wp_usermeta um</span></span>
<span class="line"><span style="color: #569CD6">LEFT JOIN</span><span style="color: #D4D4D4"> wp_users wu </span><span style="color: #569CD6">ON</span><span style="color: #D4D4D4"> wu.ID = um.user_id</span></span>
<span class="line"><span style="color: #569CD6">WHERE</span><span style="color: #D4D4D4"> wu.ID </span><span style="color: #569CD6">IS</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">NULL</span><span style="color: #D4D4D4">;</span></span></code></pre><span style="display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative">SQL</span></div>



<h3 class="wp-block-heading">Limpe metadados órfãos de termos</h3>



<p>Se categorias e tags foram excluídas, os metadados podem continuar ocupando espaço.</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Hack" style="font-size:.875rem;font-family:Code-Pro-Hack,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">SQL</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>DELETE tm FROM wp_termmeta tm
LEFT JOIN wp_terms wt ON wt.term_id = tm.term_id
WHERE wt.term_id IS NULL;</textarea><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewbox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">DELETE</span><span style="color: #D4D4D4"> tm </span><span style="color: #569CD6">FROM</span><span style="color: #D4D4D4"> wp_termmeta tm</span></span>
<span class="line"><span style="color: #569CD6">LEFT JOIN</span><span style="color: #D4D4D4"> wp_terms wt </span><span style="color: #569CD6">ON</span><span style="color: #D4D4D4"> wt.term_id = tm.term_id</span></span>
<span class="line"><span style="color: #569CD6">WHERE</span><span style="color: #D4D4D4"> wt.term_id </span><span style="color: #569CD6">IS</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">NULL</span><span style="color: #D4D4D4">;</span></span></code></pre><span style="display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative">SQL</span></div>



<h3 class="wp-block-heading">Otimizar todas as tabelas do WordPress</h3>



<p>Otimizar tabelas melhora <strong>a organização dos dados</strong> e <strong>reduz fragmentação</strong>, tornando o banco mais rápido. Execute este comando no <strong>phpMyAdmin</strong>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Hack" style="font-size:.875rem;font-family:Code-Pro-Hack,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7">SQL</span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>OPTIMIZE TABLE wp_posts, wp_postmeta, wp_options, wp_comments, wp_commentmeta, wp_terms, wp_termmeta, wp_users, wp_usermeta;</textarea><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewbox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">OPTIMIZE </span><span style="color: #569CD6">TABLE</span><span style="color: #D4D4D4"> wp_posts, wp_postmeta, wp_options, wp_comments, wp_commentmeta, wp_terms, wp_termmeta, wp_users, wp_usermeta;</span></span></code></pre><span style="display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative">SQL</span></div>



<p><strong>Dica</strong>: Use o plugin <strong>WP-Optimize</strong> para fazer isso regularmente!</p>



<h2 class="wp-block-heading">Extras para manter seu banco de dados sempre leve</h2>



<ul class="wp-block-list">
<li><strong>Desative o uso excessivo de plugins</strong>: quanto menos plugins ativos, mais rápido será o carregamento. Use apenas <strong>o necessário</strong>!</li>



<li><strong>Use um plugin de cache</strong>: plugins como <strong>WP Rocket</strong>, <strong>W3 Total Cache</strong> e <strong>LiteSpeed Cache</strong> reduzem <strong>requisições ao banco de dados</strong>.</li>



<li><strong>Minimize consultas desnecessárias</strong>: algumas funções do WordPress fazem <strong>consultas muito pesadas</strong> (como <code>query_posts</code>). Verifique se o código usa <code>WP_Query</code> corretamente.</li>



<li><strong>Exclua registros inúteis no wp_options</strong>: tabelas como <code>wp_options</code> podem ficar <strong>cheias de dados antigos e inúteis</strong>, prejudicando o desempenho.</li>



<li><strong>Monitore com ferramentas de otimização</strong>: use plugins como <strong>Query Monitor</strong> ou <strong>Debug Bar</strong> para verificar <strong>consultas lentas</strong> e ajustar seu banco de dados.</li>
</ul>



<p><strong>Agora seu WordPress estará limpo e otimizado!</strong> Se precisar de ajuda com suas estratégias de desenvolvimento web e marketing digital, entre cem contato com a Pink and Brain, os ratos do digital.</p>
<p>O post <a href="https://www.pinkandbrain.com/saiba-como-limpar-e-otimizar-o-banco-de-dados-de-sites-wordpress/">Saiba como limpar e otimizar o banco de dados de sites WordPress</a> apareceu primeiro em <a href="https://www.pinkandbrain.com">Pink and Brain</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
