Subject | Re: [ib-support] Speed problem |
---|---|
Author | lester@lsces.globalnet.co.uk |
Post date | 2001-09-03T12:46:48Z |
> I cannot answer your question, but wonder what your PLANs are -All simple indexes - adding extra aliases makes no
> particularly for the subselects. And does it make any difference if you
> extend your use of use of aliases, i.e.
difference
> AND T3.PREVIOUS >= ( SELECT R4.X FROM ROOMSTAT R4 WHERE R4.TAG =Yes this should have been
> T.ROOM )
> //This is probably a copying mistake? AND PREVIOUS < ( SELECT Y FROM
> ROOMSTAT WHERE TAG = T.ROOM )
AND T3.PREVIOUS >= ( SELECT R4.Y FROM ROOMSTAT R4 WHERE
R4.TAG = T.ROOM )
> Roomstat.tag is something you want an index on (of course), and probablyWhy would I want a compound index?
> also a compound index on (transactions.room, transactions.applet,
> transactions.ticket_ref - important to have transaction.ticket_ref behind
> the other fields of this index). I don't quite understand why you use >=
> when saying it is greater than (you only use < for less than), but the
> logic behind everything is all yours.
ROOMSTAT.TAG is Indexed along with TICKET_REF, but no
compound indexes.
SELECT COUNT (*) FROM TRANSACTIONS
WHERE TICKET_REF BETWEEN :FROMD AND :TOD
AND APPLET = :APPLET AND ROOM = :ROOM
AND PREVIOUS < ( SELECT X FROM ROOMSTAT WHERE TAG = :ROOM )
Gives it's results in sub second time. Calling it ( and the
matching two ) 5 times gives me the information in seconds.
It is only when it gets put together in one query it takes
hours,
( >= is correct - Times are in minutes - want less the x and
greater then or equal to x. This should not make any
difference. )
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services