Subject | RE: Re[2]: [firebird-support] Re: Using VIEW (or not) |
---|---|
Author | Helen Borrie |
Post date | 2003-11-25T12:43:42Z |
At 02:17 PM 25/11/2003 +0200, you wrote:
per row because it first has to find all of the duplicates. Also, if you
have an index on currency and it only has a few possible values, you should
drop the index and possibly recreate it as a composite of currency + the PK.
Particularly if most of the rows have the same currency value, you'll
probably find a horribly long dup chain for that index when you run
gstat. Long dup chain = death to performance.
heLen
>OK, so the problem is not in view.The first one has to eliminate duplicates - that involves many more hits
>
>select distinct currency from v_stat_history where sdate between
>'1.10.2003' and '3.10.2003' and accid=2 order by row
>(9 sec)
>select currency from v_stat_history where sdate between '1.10.2003' and
>'3.10.2003' and accid=2 order by row
>(1.5 sec)
>
>The statstics and PLAN are exactly the same. Why so big time difference?
per row because it first has to find all of the duplicates. Also, if you
have an index on currency and it only has a few possible values, you should
drop the index and possibly recreate it as a composite of currency + the PK.
Particularly if most of the rows have the same currency value, you'll
probably find a horribly long dup chain for that index when you run
gstat. Long dup chain = death to performance.
heLen