Subject | Re: How to plan a query |
---|---|
Author | danyschaer |
Post date | 2008-12-09T20:12:09Z |
Hi Dmitry;
the index, I asked to Flamerobin for the plan, and FB said:
Starting transaction...
Preparing query: select m1."PROC",m1."FECH",m1."HORA",m1."DSCR"
from "MOVI" m1 where m1."FECH"=(select max(m2."FECH") from "MOVI" m2
where m1."PROC"=m2."PROC" and m2."TIPO" = '1' and m2."HECH" = 'P')
and m1."TIPO" = '1' and m1."HECH" = 'P'
Prepare time: 00:00:00.
Field #01: MOVI.PROC Alias:PROC Type:STRING(10)
Field #02: MOVI.FECH Alias:FECH Type:STRING(8)
Field #03: MOVI.HORA Alias:HORA Type:STRING(4)
Field #04: MOVI.DSCR Alias:DSCR Type:STRING(200)
PLAN (M2 ORDER MOVI_FECH_DESC INDEX (MOVI_PROC))
PLAN (M1 INDEX (MOVI_TIPO, MOVI_HECH))
Script execution finished.
But when I excecute the query, it starts a very large process ... I
will left the machine working, and I will tell you when finished.
Thank you.
Dany
>Casually, I am trying exaclty the same idea right now. After building
> CREATE DESCENDING INDEX MOVI_FECH_DESC ON MOVI (FECH);
>
> I'd be interested in the timings and the plan with the above index.
the index, I asked to Flamerobin for the plan, and FB said:
Starting transaction...
Preparing query: select m1."PROC",m1."FECH",m1."HORA",m1."DSCR"
from "MOVI" m1 where m1."FECH"=(select max(m2."FECH") from "MOVI" m2
where m1."PROC"=m2."PROC" and m2."TIPO" = '1' and m2."HECH" = 'P')
and m1."TIPO" = '1' and m1."HECH" = 'P'
Prepare time: 00:00:00.
Field #01: MOVI.PROC Alias:PROC Type:STRING(10)
Field #02: MOVI.FECH Alias:FECH Type:STRING(8)
Field #03: MOVI.HORA Alias:HORA Type:STRING(4)
Field #04: MOVI.DSCR Alias:DSCR Type:STRING(200)
PLAN (M2 ORDER MOVI_FECH_DESC INDEX (MOVI_PROC))
PLAN (M1 INDEX (MOVI_TIPO, MOVI_HECH))
Script execution finished.
But when I excecute the query, it starts a very large process ... I
will left the machine working, and I will tell you when finished.
Thank you.
Dany