Subject | Re: [ib-support] Strange query problem |
---|---|
Author | Martijn Tonies |
Post date | 2003-02-12T15:00:41Z |
> > I have a query:Even more - WHY should it read indexed if you don't use any
> >
> > "select hist.cguid from con_discon_info hist"
> >
> > Table "con_discon_info" has an index on field "cguid".
> > After query execution I can see in the performance monitor that all of
> > the reads where non-indexed reads
> >
> > If I modify the querylike this:
> >
> > "select hist.cguid from con_discon_info hist group by cguid"
> > ^^^^^^^^^^^^^^^
> > All reads become indexed ?????
> >
> > Any ideas.
>
> Yes, use order by instead of group by.
>
> Just selecting an indexed field doesn't convince the optimizer to use
> the index ;-)
WHERE clause ... you want all rows, Firebird/IB will give it to
you and in that case, a "natural" (unindexed) read is fastest.
With regards,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."