|
show create table:
CREATE TABLE `nf_erro_20130620` (
`emitente_tipo` enum('f','j') NOT NULL DEFAULT 'f',
`emitente_id` int(10) unsigned NOT NULL DEFAULT '0',
`emitente_propriedade` tinyint(3) unsigned NOT NULL DEFAULT '0',
`nf_serie` char(5) NOT NULL DEFAULT 'A',
`nf` int(11) NOT NULL DEFAULT '0',
`id_item` int(11) NOT NULL DEFAULT '0',
`status` enum('ok','c','d','nf','i') NOT NULL DEFAULT 'ok',
`unidade_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`lote_tipo` enum('v','c') NOT NULL DEFAULT 'v',
`lote_spa` decimal(12,1) NOT NULL DEFAULT '0.0',
`oe_tipo` enum('oe','fec') NOT NULL DEFAULT 'oe',
`oe` bigint(20) NOT NULL DEFAULT '0',
`oe_seq` mediumint(9) NOT NULL DEFAULT '0',
`item_id` smallint(5) unsigned NOT NULL DEFAULT '0',
`item_id_red` mediumint(9) NOT NULL DEFAULT '0',
`item_codigo` char(30) NOT NULL DEFAULT '0',
`item_desc` char(100) NOT NULL DEFAULT '',
`servico` enum('Y','N') NOT NULL DEFAULT 'N',
`documento_auxiliar` enum('Y','N') NOT NULL DEFAULT 'N',
`cfop_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
`cfop_id_red` int(11) NOT NULL DEFAULT '0',
`cfop_numero` varchar(10) NOT NULL DEFAULT '',
`class_fiscal` char(20) NOT NULL DEFAULT '',
`sit_trib` char(3) NOT NULL DEFAULT '',
`sit_trib_ipi` char(3) NOT NULL DEFAULT '',
`sit_trib_pis` char(3) NOT NULL DEFAULT '',
`sit_trib_cofins` char(3) NOT NULL DEFAULT '',
`sit_trib_iss` varchar(1) NOT NULL DEFAULT '',
`sit_trib_sn` varchar(4) NOT NULL DEFAULT '',
`icms_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`icms_subst_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`ipi_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`pis_inclur_bc` varchar(5) NOT NULL DEFAULT '',
`cofins_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`ii_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`sn_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`un_fat` char(5) NOT NULL DEFAULT '',
`quant` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pecas` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pbruto` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pliq` decimal(17,5) NOT NULL DEFAULT '0.00000',
`vliq` decimal(17,5) NOT NULL DEFAULT '0.00000',
`vbruto` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_pauta` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_pauta_grandeza` enum('un','up','pl','pb','@pl','@pb','vl','vb') NOT NULL DEFAULT 'un',
`valor_pauta_grandeza_quant` decimal(17,5) NOT NULL DEFAULT '1.00000',
`valor_produto_un` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_produto_grandeza` enum('un','up','pl','pb','@pl','@pb','vl','vb') NOT NULL DEFAULT 'un',
`valor_produto_grandeza_quant` decimal(10,5) NOT NULL DEFAULT '1.00000',
`valor_produto_tabela_un` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_produto_total` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_frete` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_seguro` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`valor_outras` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`valor_estimado_impostos` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000' COMMENT 'lei da transparencia',
`valor_estimado_impostos_por` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`desconto` decimal(17,5) NOT NULL DEFAULT '0.00000',
`icms_de_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_de_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_fe_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_fe_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`icms_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`icms_subst_ind_convenio` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_subst_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`icms_subst_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`ipi_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ipi_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ipi_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`ipi_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`iss_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`iss_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`iss_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`iss_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pis_aliq` decimal(10,5) NOT NULL DEFAULT '0.00000',
`pis_red` decimal(10,5) NOT NULL DEFAULT '0.00000',
`pis_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pis_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`cofins_aliq` decimal(10,5) NOT NULL DEFAULT '0.00000',
`cofins_red` decimal(10,5) NOT NULL DEFAULT '0.00000',
`cofins_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`cofins_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`funrural_aliq` decimal(10,5) NOT NULL DEFAULT '0.00000',
`funrural_red` decimal(10,5) NOT NULL DEFAULT '0.00000',
`funrural_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`funrural_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sn_aliq` decimal(10,5) NOT NULL DEFAULT '0.00000',
`sn_red` decimal(10,5) NOT NULL DEFAULT '0.00000',
`sn_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sn_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`cide_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`cide_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`cide_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`cide_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`csll_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`csll_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`csll_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`csll_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sit_trib_csll` varchar(4) NOT NULL DEFAULT '',
`inss_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`inss_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`inss_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`inss_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sit_trib_inss` varchar(4) NOT NULL DEFAULT '',
`ir_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ir_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ir_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`ir_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sit_trib_ir` varchar(4) NOT NULL DEFAULT '',
`ii_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ii_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ii_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`ii_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sit_trib_ii` varchar(4) NOT NULL DEFAULT '',
`numero_pedido_compra` varchar(25) NOT NULL DEFAULT '',
`numero_item_pedido` varchar(25) NOT NULL DEFAULT '',
`obs_item` varchar(255) NOT NULL DEFAULT '',
`quant_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`pecas_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`pbruto_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`pliq_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`vliq_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`vbruto_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`ii_anterior_un` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`ipi_anterior_un` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`pis_anterior_un` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`cofins_anterior_un` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
PRIMARY KEY (`emitente_tipo`,`emitente_id`,`emitente_propriedade`,`nf_serie`,`nf`,`id_item`),
KEY `spamov` (`unidade_id`,`lote_tipo`,`lote_spa`,`item_id`,`item_id_red`),
KEY `item_id` (`emitente_tipo`,`emitente_id`,`emitente_propriedade`,`nf_serie`,`nf`,`item_id`,`item_id_red`)
) ENGINE=Aria DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (nf)
(PARTITION s0 VALUES LESS THAN (100000) ENGINE = Aria,
PARTITION s1 VALUES LESS THAN (450000) ENGINE = Aria,
PARTITION s2 VALUES LESS THAN (800000) ENGINE = Aria,
PARTITION s3 VALUES LESS THAN MAXVALUE ENGINE = Aria) */
|
|
running create table without index, it works nice (but don't use index...)
getting back to my last comment, i'm near sure that index statistics is corrupted while running insert
example of create table without index:
CREATE TABLE `t7` (
`emitente_tipo` enum('f','j') NOT NULL DEFAULT 'f',
`emitente_id` int(10) unsigned NOT NULL DEFAULT '0',
`emitente_propriedade` tinyint(3) unsigned NOT NULL DEFAULT '0',
`nf_serie` char(5) NOT NULL DEFAULT 'A',
`nf` int(11) NOT NULL DEFAULT '0',
`id_item` int(11) NOT NULL DEFAULT '0',
`status` enum('ok','c','d','nf','i') NOT NULL DEFAULT 'ok',
`unidade_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`lote_tipo` enum('v','c') NOT NULL DEFAULT 'v',
`lote_spa` decimal(12,1) NOT NULL DEFAULT '0.0',
`oe_tipo` enum('oe','fec') NOT NULL DEFAULT 'oe',
`oe` bigint(20) NOT NULL DEFAULT '0',
`oe_seq` mediumint(9) NOT NULL DEFAULT '0',
`item_id` smallint(5) unsigned NOT NULL DEFAULT '0',
`item_id_red` mediumint(9) NOT NULL DEFAULT '0',
`item_codigo` char(30) NOT NULL DEFAULT '0',
`item_desc` char(100) NOT NULL DEFAULT '',
`servico` enum('Y','N') NOT NULL DEFAULT 'N',
`documento_auxiliar` enum('Y','N') NOT NULL DEFAULT 'N',
`cfop_id` tinyint(3) unsigned NOT NULL DEFAULT '0',
`cfop_id_red` int(11) NOT NULL DEFAULT '0',
`cfop_numero` varchar(10) NOT NULL DEFAULT '',
`class_fiscal` char(20) NOT NULL DEFAULT '',
`sit_trib` char(3) NOT NULL DEFAULT '',
`sit_trib_ipi` char(3) NOT NULL DEFAULT '',
`sit_trib_pis` char(3) NOT NULL DEFAULT '',
`sit_trib_cofins` char(3) NOT NULL DEFAULT '',
`sit_trib_iss` varchar(1) NOT NULL DEFAULT '',
`sit_trib_sn` varchar(4) NOT NULL DEFAULT '',
`icms_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`icms_subst_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`ipi_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`pis_inclur_bc` varchar(5) NOT NULL DEFAULT '',
`cofins_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`ii_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`sn_incluir_bc` varchar(5) NOT NULL DEFAULT '',
`un_fat` char(5) NOT NULL DEFAULT '',
`quant` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pecas` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pbruto` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pliq` decimal(17,5) NOT NULL DEFAULT '0.00000',
`vliq` decimal(17,5) NOT NULL DEFAULT '0.00000',
`vbruto` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_pauta` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_pauta_grandeza` enum('un','up','pl','pb','@pl','@pb','vl','vb') NOT NULL DEFAULT 'un',
`valor_pauta_grandeza_quant` decimal(17,5) NOT NULL DEFAULT '1.00000',
`valor_produto_un` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_produto_grandeza` enum('un','up','pl','pb','@pl','@pb','vl','vb') NOT NULL DEFAULT 'un',
`valor_produto_grandeza_quant` decimal(10,5) NOT NULL DEFAULT '1.00000',
`valor_produto_tabela_un` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_produto_total` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_frete` decimal(17,5) NOT NULL DEFAULT '0.00000',
`valor_seguro` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`valor_outras` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`valor_estimado_impostos` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000' COMMENT 'lei da transparencia',
`valor_estimado_impostos_por` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`desconto` decimal(17,5) NOT NULL DEFAULT '0.00000',
`icms_de_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_de_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_fe_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_fe_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`icms_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`icms_subst_ind_convenio` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`icms_subst_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`icms_subst_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`ipi_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ipi_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ipi_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`ipi_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`iss_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`iss_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`iss_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`iss_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pis_aliq` decimal(10,5) NOT NULL DEFAULT '0.00000',
`pis_red` decimal(10,5) NOT NULL DEFAULT '0.00000',
`pis_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`pis_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`cofins_aliq` decimal(10,5) NOT NULL DEFAULT '0.00000',
`cofins_red` decimal(10,5) NOT NULL DEFAULT '0.00000',
`cofins_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`cofins_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`funrural_aliq` decimal(10,5) NOT NULL DEFAULT '0.00000',
`funrural_red` decimal(10,5) NOT NULL DEFAULT '0.00000',
`funrural_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`funrural_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sn_aliq` decimal(10,5) NOT NULL DEFAULT '0.00000',
`sn_red` decimal(10,5) NOT NULL DEFAULT '0.00000',
`sn_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sn_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`cide_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`cide_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`cide_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`cide_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`csll_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`csll_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`csll_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`csll_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sit_trib_csll` varchar(4) NOT NULL DEFAULT '',
`inss_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`inss_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`inss_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`inss_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sit_trib_inss` varchar(4) NOT NULL DEFAULT '',
`ir_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ir_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ir_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`ir_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sit_trib_ir` varchar(4) NOT NULL DEFAULT '',
`ii_aliq` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ii_red` decimal(10,7) NOT NULL DEFAULT '0.0000000',
`ii_basecalculo` decimal(17,5) NOT NULL DEFAULT '0.00000',
`ii_valor` decimal(17,5) NOT NULL DEFAULT '0.00000',
`sit_trib_ii` varchar(4) NOT NULL DEFAULT '',
`numero_pedido_compra` varchar(25) NOT NULL DEFAULT '',
`numero_item_pedido` varchar(25) NOT NULL DEFAULT '',
`obs_item` varchar(255) NOT NULL DEFAULT '',
`quant_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`pecas_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`pbruto_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`pliq_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`vliq_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`vbruto_devolvida` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`ii_anterior_un` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`ipi_anterior_un` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`pis_anterior_un` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000',
`cofins_anterior_un` decimal(17,5) unsigned NOT NULL DEFAULT '0.00000'
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
|