Subject | Simple query takes too much time |
---|---|
Author | Jorge Andrés Brugger |
Post date | 2015-07-29T16:58:49Z |
I´ve a medium-sized DB. Some tables have millions of records, but one in
particular has just 7100
Table DDL follows:
CREATE TABLE TRAZABILIDAD_MEDICAMENTOS (
GTIN D_GTIN NOT NULL /* D_GTIN = DECIMAL(14,0) */,
FECHA_ALTA D_FECHA /* D_FECHA = DATE */,
ACTIVO D_LOGICO DEFAULT 0 /* D_LOGICO = SMALLINT NOT NULL CHECK
(value in(1,0)) */
);
ALTER TABLE TRAZABILIDAD_MEDICAMENTOS ADD CONSTRAINT
PK_TRAZABILIDAD_MEDICAMENTOS PRIMARY KEY (GTIN);
Using MSAccess, a single query to this table takes an average of 14 ms.
Next is the trace log:
Statement 56728:
-------------------------------------------------------------------------------
SELECT "GTIN" ,"ACTIVO" FROM "TRAZABILIDAD_MEDICAMENTOS" WHERE ("GTIN"
= ?)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PLAN (TRAZABILIDAD_MEDICAMENTOS INDEX (PK_TRAZABILIDAD_MEDICAMENTOS))
param0 = bigint, "7795312000796"
2015-07-29T13:34:58.1530 (1049:0x7f974f340168) COMMIT_TRANSACTION
farmaclick (ATT_107403, SYSDBA:NONE, ISO88591, TCPv4:192.168.1.54)
C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE:5500
(TRA_71743787, READ_COMMITTED | REC_VERSION | WAIT | READ_WRITE)
14 ms, 1 read(s), 1 write(s), 1 fetch(es), 1 mark(s)
2015-07-29T13:34:58.1700 (1049:0x7f974f340168) START_TRANSACTION
farmaclick (ATT_107403, SYSDBA:NONE, ISO88591, TCPv4:192.168.1.54)
C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE:5500
(TRA_71743788, READ_COMMITTED | REC_VERSION | WAIT | READ_WRITE)
2015-07-29T13:34:58.1710 (1049:0x7f974f340168) EXECUTE_STATEMENT_START
farmaclick (ATT_107403, SYSDBA:NONE, ISO88591, TCPv4:192.168.1.54)
C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE:5500
(TRA_71743788, READ_COMMITTED | REC_VERSION | WAIT | READ_WRITE)
Most queries to DB takes 0 or 1 ms. even to much bigger tables.
What could be wrong with this specific table?
Using FB 2.5.4 64 bits on Ubuntu Server
Thanks!
--
Jorge Andrés Brugger
Departamento de Informática
DASU - Obra Social del Personal de la Universidad Nacional de la Patagonia
Comodoro Rivadavia, Chubut, Argentina
Teléfono (0297) 446-4444 int. 103
Correo electrónico: jbrugger@...
Website: www.dasu.com.ar
"Aquel que tiene una opinión de sí mismo, pero depende de la opinión y los gustos de los demás, es un esclavo" (Friedrich Gottlieb Klopstock)
--
Antes de imprimir este mensaje, piense si es verdaderamente necesario hacerlo.
particular has just 7100
Table DDL follows:
CREATE TABLE TRAZABILIDAD_MEDICAMENTOS (
GTIN D_GTIN NOT NULL /* D_GTIN = DECIMAL(14,0) */,
FECHA_ALTA D_FECHA /* D_FECHA = DATE */,
ACTIVO D_LOGICO DEFAULT 0 /* D_LOGICO = SMALLINT NOT NULL CHECK
(value in(1,0)) */
);
ALTER TABLE TRAZABILIDAD_MEDICAMENTOS ADD CONSTRAINT
PK_TRAZABILIDAD_MEDICAMENTOS PRIMARY KEY (GTIN);
Using MSAccess, a single query to this table takes an average of 14 ms.
Next is the trace log:
Statement 56728:
-------------------------------------------------------------------------------
SELECT "GTIN" ,"ACTIVO" FROM "TRAZABILIDAD_MEDICAMENTOS" WHERE ("GTIN"
= ?)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PLAN (TRAZABILIDAD_MEDICAMENTOS INDEX (PK_TRAZABILIDAD_MEDICAMENTOS))
param0 = bigint, "7795312000796"
2015-07-29T13:34:58.1530 (1049:0x7f974f340168) COMMIT_TRANSACTION
farmaclick (ATT_107403, SYSDBA:NONE, ISO88591, TCPv4:192.168.1.54)
C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE:5500
(TRA_71743787, READ_COMMITTED | REC_VERSION | WAIT | READ_WRITE)
14 ms, 1 read(s), 1 write(s), 1 fetch(es), 1 mark(s)
2015-07-29T13:34:58.1700 (1049:0x7f974f340168) START_TRANSACTION
farmaclick (ATT_107403, SYSDBA:NONE, ISO88591, TCPv4:192.168.1.54)
C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE:5500
(TRA_71743788, READ_COMMITTED | REC_VERSION | WAIT | READ_WRITE)
2015-07-29T13:34:58.1710 (1049:0x7f974f340168) EXECUTE_STATEMENT_START
farmaclick (ATT_107403, SYSDBA:NONE, ISO88591, TCPv4:192.168.1.54)
C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE:5500
(TRA_71743788, READ_COMMITTED | REC_VERSION | WAIT | READ_WRITE)
Most queries to DB takes 0 or 1 ms. even to much bigger tables.
What could be wrong with this specific table?
Using FB 2.5.4 64 bits on Ubuntu Server
Thanks!
--
Jorge Andrés Brugger
Departamento de Informática
DASU - Obra Social del Personal de la Universidad Nacional de la Patagonia
Comodoro Rivadavia, Chubut, Argentina
Teléfono (0297) 446-4444 int. 103
Correo electrónico: jbrugger@...
Website: www.dasu.com.ar
"Aquel que tiene una opinión de sí mismo, pero depende de la opinión y los gustos de los demás, es un esclavo" (Friedrich Gottlieb Klopstock)
--
Antes de imprimir este mensaje, piense si es verdaderamente necesario hacerlo.