davidc2
05-19-2009, 09:50 PM
I have a large set of data (a little over 2 million records on one of the tables, and like 5 smaller tables, with less than 1000 records each)..
When I try some queries on it, they run very slow the first time, but very fast afterwards, I tried "query_cache_type = 0" to see if I could get them slow everytime and see if cache was the problem, but it seems to me it isn´t, because it is still slow at first, then fast.
One of the queries:
SELECT
cv.nombre, contacto.manzana, nucleo.nucleo,
rep.cedula,
rep.p_apellido, rep.s_apellido, rep.p_nombre, rep.s_nombre,
contacto.telefono, contacto.calle, contacto.ncasa, contacto.apto
FROM contacto
LEFT JOIN nucleo ON contacto.id_nucleo = nucleo.id
INNER JOIN rep ON contacto.cedula = rep.cedula
LEFT JOIN cv ON rep.codigo_cv = cv.codigo_centro_votacion
WHERE contacto.vive_en_la_parroquia = 'si'
AND rep.codigo_cv
NOT IN (SELECT codigo_centro_votacion FROM cv WHERE codigo_estado = '21' AND codigo_municipio = '5' AND codigo_parroquia = '4' )
ORDER BY rep.codigo_cv, contacto.manzana, contacto.id_nucleo
I´m running WAMP so I can play with the settings if anyone has suggestions...
When I try some queries on it, they run very slow the first time, but very fast afterwards, I tried "query_cache_type = 0" to see if I could get them slow everytime and see if cache was the problem, but it seems to me it isn´t, because it is still slow at first, then fast.
One of the queries:
SELECT
cv.nombre, contacto.manzana, nucleo.nucleo,
rep.cedula,
rep.p_apellido, rep.s_apellido, rep.p_nombre, rep.s_nombre,
contacto.telefono, contacto.calle, contacto.ncasa, contacto.apto
FROM contacto
LEFT JOIN nucleo ON contacto.id_nucleo = nucleo.id
INNER JOIN rep ON contacto.cedula = rep.cedula
LEFT JOIN cv ON rep.codigo_cv = cv.codigo_centro_votacion
WHERE contacto.vive_en_la_parroquia = 'si'
AND rep.codigo_cv
NOT IN (SELECT codigo_centro_votacion FROM cv WHERE codigo_estado = '21' AND codigo_municipio = '5' AND codigo_parroquia = '4' )
ORDER BY rep.codigo_cv, contacto.manzana, contacto.id_nucleo
I´m running WAMP so I can play with the settings if anyone has suggestions...