Subject | Re: [firebird-support] Re: Query optimization again |
---|---|
Author | Kjell Rilbe |
Post date | 2005-02-22T13:36:01Z |
Svein Erling Tysvær wrote:
because the entire SQL statement is generated on the fly so everything
is hardcoded right into the statement. Parameters would just be a
roundabout way of doing it. But I think I keep forgetting about STARTING
when it *would* be useful, so... :-)
but. What *is* fixed and very well defined is the value set of
CHILD.FIELD (it's the set of SNI2002 line-of-business codes). But it's
up to the user to select *any* set of codes to match on.
didn't follow you before. :-)
Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64
> Please consider using STARTING as well. As long as you hardcode 'xy%'Thank you for reminding me of STARTING. In this case It doesn't matter
> it doesn't make any difference (well, off the top of my head I don't
> remember whether one of them is case sensitive and the other not), but
> once you start using parametres, then STARTING can use an index
> whereas LIKE cannot.
because the entire SQL statement is generated on the fly so everything
is hardcoded right into the statement. Parameters would just be a
roundabout way of doing it. But I think I keep forgetting about STARTING
when it *would* be useful, so... :-)
> If the criteria is somewhat fixed, you could also add another field orI don't follow you here. The set of criteria is *not* fixed. Anything
> table and use that to group the records. Using
>
> JOIN KJELLGROUPS ON KJELLGROUPS.FIELD = CHILD.FIELD
> WHERE KJELLGROUPS.CurrentGroup = :Query1Value
but. What *is* fixed and very well defined is the value set of
CHILD.FIELD (it's the set of SNI2002 line-of-business codes). But it's
up to the user to select *any* set of codes to match on.
> sounds much more tempting to me than ORing 283 values - regardless ofSorry, don't follow you here either, but that's probably because I
> speed (speedwise, I think you could benefit from having one such
> indexed field (CurrentGroup, PK) in the main table, but doubt anything
> could be gained with a lookup table).
didn't follow you before. :-)
Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64