Subject | Two questions regarding performance |
---|---|
Author | Sergio H. Gonzalez |
Post date | 2010-04-29T13:09:55Z |
Hi! Probably these questions were asked before, but I can't find nothing on the
web (perhaps I'm not seeking properly)
1) Having some clauses concatenated with "and" in a where statement, does it
matter the order of the clauses? I mean: I always tend to put in the first order
the clauses that have an index (ie: PK) and then the clauses that don't have
index. Is that OK? or Firebird just "know" what sentence is better to evaluate
first?
2) Does the "or" operator decrease the performance? I have some where like this:
where (ID = :ID) or (:ID = -1)
So I pass -1 when I want all the records. Is that OK? Or is better to
reconstruct the select in the client, depending what I want '
Thanks!!!
sergio
web (perhaps I'm not seeking properly)
1) Having some clauses concatenated with "and" in a where statement, does it
matter the order of the clauses? I mean: I always tend to put in the first order
the clauses that have an index (ie: PK) and then the clauses that don't have
index. Is that OK? or Firebird just "know" what sentence is better to evaluate
first?
2) Does the "or" operator decrease the performance? I have some where like this:
where (ID = :ID) or (:ID = -1)
So I pass -1 when I want all the records. Is that OK? Or is better to
reconstruct the select in the client, depending what I want '
Thanks!!!
sergio