Subject | Re: [IBO] Order By |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-03-04T15:34:28Z |
At 02:10 PM 04-03-02 +0000, you wrote:
you copy it and post it?
It sounds as if either you have no indexing on the three fields or, if you
do, you have conflicting indexes.
when you are sorting by multiple columns - otherwise it just has to walk
the dataset multiple times and form intermediate sets until it completes
the required sort.
You could *try*
myIBOQuery.InternalDataset.RecordCount immediately after the Open call, and
compare the speed of that with select count(*) which is horribly expensive...
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com
>I have a query which returns instantly, until I add the 'Order By'It would be interesting to see both the query statement and the plan. Can
>clause and order the result with three fields. The query then takes
>50 seconds ( The plan stays the same ).
you copy it and post it?
It sounds as if either you have no indexing on the three fields or, if you
do, you have conflicting indexes.
>Surely a result set should be ordered afterwardsYes, it is. But the engine needs good indexes to work with, especially
when you are sorting by multiple columns - otherwise it just has to walk
the dataset multiple times and form intermediate sets until it completes
the required sort.
> - if not is there aNo.
>way the tiboquery can order the result once the 'non-ordered' query
>has been executed ?
>A related 2nd question - if I get a result set and also want to countUnless you have an absolute requirement to count records, DON'T.
>how many records in the result - I see the query is fired again when
>I use the recordcount method, replacing the select ... with select
>count(*) How can I just count the records of the result ?
You could *try*
myIBOQuery.InternalDataset.RecordCount immediately after the Open call, and
compare the speed of that with select count(*) which is horribly expensive...
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com