Subject Re: ODP: [firebird-support] Query that was very fast under the oldest 2.5 versions are very slow under 2.5.8 or 2.5.9
Author
Hi Karol;

But this is not the problem, because 2.5.0 does this query very fast, with no special cache settings. The very important diference is the plan. 2.5.8  is not using MOVI_FECH index, so it must read more than one millon records to analize ("MOVI"."FECH" between '20190301' and '20190412'). This is the MOVI ddl:

CREATE TABLE MOVI
(
  MOVI Char(10) NOT NULL COLLATE ES_ES_AI,
  PROC Char(10) NOT NULL COLLATE ES_ES_AI,
  MIEM Char(10) NOT NULL COLLATE ES_ES_AI,
  TIPO Char(1) NOT NULL COLLATE ES_ES_AI,
  AVIS Char(3) NOT NULL COLLATE ES_ES_AI,
  HECH Char(1) NOT NULL COLLATE ES_ES_AI,
  FECH Char(8) NOT NULL COLLATE ES_ES_AI,
  HORA Char(4) NOT NULL COLLATE ES_ES_AI,
  DSCR Varchar(200) NOT NULL COLLATE ES_ES_AI,
  FOJA Varchar(10) NOT NULL COLLATE ES_ES_AI,
  PRES Char(1) NOT NULL COLLATE ES_ES_AI,
  REPI Char(1) NOT NULL COLLATE ES_ES_AI,
  OWNR Char(10) NOT NULL COLLATE ES_ES_AI,
  TEXT Blob sub_type 0,
  "EDIT" Char(23) NOT NULL COLLATE ES_ES_AI,
  CONSTRAINT MOVI_PK PRIMARY KEY (MOVI)
);
CREATE INDEX MOVI_FECH ON MOVI (FECH,HORA);
CREATE INDEX MOVI_HECH ON MOVI (HECH);
CREATE INDEX MOVI_MIEM ON MOVI (MIEM);
CREATE INDEX MOVI_OWNR ON MOVI (OWNR);
CREATE INDEX MOVI_PRES ON MOVI (PRES);
CREATE INDEX MOVI_PROC ON MOVI (PROC);
CREATE INDEX MOVI_REPI ON MOVI (REPI);
CREATE INDEX MOVI_TIPO ON MOVI (TIPO);

Thank you.