Thursday, 22 August 2013

Problems with a MySQL server change

Problems with a MySQL server change

I have three tables in MySQL:
CREATE TABLE mlm.facturacion_2012_drm_base ( custid varchar(20) NOT NULL,
fecha date NOT NULL, docid varchar(20) NOT NULL, billid varchar(20) NOT
NULL, movimiento varchar(20) DEFAULT NULL, movid varchar(20) DEFAULT NULL,
medio_pago varchar(40) DEFAULT NULL, digitos varchar(20) DEFAULT NULL,
monto_facturado decimal(20,2) NOT NULL, monto_pagado decimal(20,2) NOT
NULL, monto_usado decimal(20,2) NOT NULL,
documento varchar(2) NOT NULL, codigo_pago varchar(5) DEFAULT NULL,
desc_pago varchar(100) DEFAULT NULL, sociedad varchar(45) DEFAULT NULL,
sociedad_bonif varchar(45) DEFAULT NULL, KEY billid (billid), KEY
motors_no_fact (custid,billid,fecha,documento) USING BTREE, KEY
facturacion (custid,fecha,documento) USING BTREE ) ENGINE=MyISAM DEFAULT
CHARSET=latin1 ROW_FORMAT=DYNAMIC;
CREATE TABLE mlm.facturacion_2012_drm_cortes ( id bigint(20) NOT NULL
AUTO_INCREMENT, fecha_inicial date NOT NULL,
fecha_final date NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM
AUTO_INCREMENT=433 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
CREATE TABLE mlm.facturacion_2012_drm_emitidas ( id bigint(20) NOT NULL
AUTO_INCREMENT, custid varchar(20) NOT NULL,
fecha_emision date NOT NULL, id_fechas bigint(20) NOT NULL,
monto decimal(20,2) NOT NULL, iva decimal(20,2) NOT NULL,
total decimal(20,2) NOT NULL, medio_pago varchar(2000) NOT NULL, digitos
varchar(100) NOT NULL, operaciones int(10) NOT NULL,
activa varchar(2) NOT NULL, movimiento varchar(45) NOT NULL,
parcialidades varchar(100) NOT NULL, monto_bruto decimal(20,2) NOT NULL,
billid varchar(45) NOT NULL, serie varchar(2) DEFAULT NULL, folio int(10)
DEFAULT NULL, uuid varchar(45) DEFAULT NULL, PRIMARY KEY (id), KEY motors
(billid,id_fechas,activa) ) ENGINE=MyISAM AUTO_INCREMENT=511483 DEFAULT
CHARSET=latin1;
I changed the MySQL server from 5.1 (32 Bits) to 5.6 (64 Bits) and
restored all my tables but I´m having problems with this query:
select a.custid, a.monto_facturado, a.billid, a.fecha, b.id, b.fecha_inicial
from facturacion_2012_drm_base a, facturacion_2012_drm_cortes b
where a.custid = any (select custid
from facturacion_motors_pendientes
where situacion = 'no facturado')
and a.billid <> all(select billid
from facturacion_2012_drm_emitidas
where activa = 'SI')
and a.fecha between b.fecha_inicial
and b.fecha_final
and a.documento = 'FA'
and year(a.fecha) = year(curdate())
group by a.billid
Since the server change, the query never finish, showing the message
"Query is being executed..."
Anybody knows why this is happening?

No comments:

Post a Comment