Skip to content

Instantly share code, notes, and snippets.

@diegorv
Created October 26, 2009 16:38
Show Gist options
  • Select an option

  • Save diegorv/218786 to your computer and use it in GitHub Desktop.

Select an option

Save diegorv/218786 to your computer and use it in GitHub Desktop.
mysql> EXPLAIN SELECT anuncios.codcli,
-> anuncios.razsocial,
-> anuncios.nomefanta,
-> anuncios.irmao,
-> anuncios.endereco,
-> anuncios.num,
-> anuncios.complemento,
-> anuncios.bairro,
-> anuncios.cidade,
-> anuncios.uf,
-> anuncios.cep,
-> anuncios.fone,
-> anuncios.fax,
-> anuncios.email,
-> anuncios.site,
-> anuncios.descricao,
-> anuncios.contrato,
-> anuncios.codprod,
-> anuncios.coditem,
-> anuncios.dtass,
-> anuncios.uf_anunciar,
-> anuncios.nome_abreviado,
-> anuncios.tipo_logradouro,
-> anuncios.fone_ddi,
-> anuncios.fone_ddd,
-> anuncios.fone_ramal,
-> anuncios.fone2_ddi,
-> anuncios.fone2_ddd,
-> anuncios.fone2_numero,
-> anuncios.fone2_ramal,
-> anuncios.fax_ddi,
-> anuncios.fax_ddd,
-> anuncios.fax_ramal,
-> anuncios.celular1_ddi,
-> anuncios.celular1_ddd,
-> anuncios.celular1_numero,
-> anuncios.celular2_ddi,
-> anuncios.celular2_ddd,
-> anuncios.celular2_numero,
-> anuncios.email2,
-> anuncios.email3,
-> anuncios.radio,
-> anuncios.skype,
-> anuncios.msn,
-> anuncios.caixapostal,
-> anuncios_imagens.local_imagem as imagem_anuncio,
-> cidades.cidade as cidade_nome,
-> estados.nome as estado_nome
-> FROM anuncios INNER JOIN estados ON estados.uf = anuncios.uf INNER JOIN cidades ON cidades.codcid = anuncios.cidade INNER JOIN anuncios_imagens ON (anuncios_imagens.numcontr=anuncios.contrato AND anuncios_imagens.dtass=anuncios.dtass AND anuncios_imagens.codprod=anuncios.codprod AND anuncios_imagens.coditem=anuncios.coditem) WHERE (anuncios.codseg = '0025') ORDER BY codtipanun DESC, nomefanta, razsocial, cidade_nome, estado_nome ASC LIMIT 0, 5
-> ;
+----+-------------+------------------+--------+---------------------------------------------------------+---------+---------+------------------------------------------+------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------------+--------+---------------------------------------------------------+---------+---------+------------------------------------------+------+----------------------------------------------+
| 1 | SIMPLE | anuncios | ref | PRIMARY,codseg,uf,cidade,contrato,coditem,codprod,dtass | codseg | 47 | const | 700 | Using where; Using temporary; Using filesort |
| 1 | SIMPLE | estados | eq_ref | PRIMARY | PRIMARY | 8 | cms_anuncios_development.anuncios.uf | 1 | |
| 1 | SIMPLE | anuncios_imagens | ref | dtass | dtass | 4 | cms_anuncios_development.anuncios.dtass | 3 | Using where |
| 1 | SIMPLE | cidades | eq_ref | PRIMARY | PRIMARY | 4 | cms_anuncios_development.anuncios.cidade | 1 | |
+----+-------------+------------------+--------+---------------------------------------------------------+---------+---------+------------------------------------------+------+----------------------------------------------+
4 rows in set (0.01 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment