Volver a la portada
Nosotros te ayudaremos a mejorarlo cada día También puedes crear un blog gratis, crear red social o Explorar Bligoo »
Emilio Davis

count(*) is the devil, stay away from it!

Escrito por Emilio Davis el 16/06/2010 en Bligoo's Tech Blog
MyISAM, an aged MySQL engine with no transactional support and awful scalabililty spoiled many developers with an ultra fast count(*) implementation. But is ultra fast only when there is no conditions in the where part of the sentence. At least in InnoDB (the common replacement for MySQL, at least until Maria gets more traction) every count(*) has to make a temporary table with all the matching lines and the count the lenght of the table. There are two ways to deal with count(*). 1.- Don't use count(*) rather count(primaryKey). In InnoDB the primary key is always part of any index ... Leer más
Etiquetas del artículo: