Subject Re: [IBO] IBOQuery re-Open/Refresh is slower?
Author Aurimas Černius
Hello,

> > I have a performance problem with TIBOQuery.
> > When I mesured times, I saw, that the first Open() is almost always
> > faster than subsequent Close() & Open() or Refresh().
> > Why can that be?
> > How can this be fixed?
> >
> > In most cases the difference is very small and are not significant in
> > real situation, where are several users working at once, but one
> > particular case has a *very* big difference: the first Open() is done in
> > about 30 miliseconds, but each next Open() or Refresh() is about 500
> > miliseconds - that exact problem I'm trying to solve. I don't see any
> > big diffrence between that select and others in the application. When
> > running that select in IBExpert I always get the same execution time
> > (less than 30 miliseconds).
>
> Rule number one in a client/server application is integrating some kind
> of monitoring/profiling facility to see what's going on.

We had some of our own, that showed the problem for us.

> Drop a TIB_MonitorDialog component onto your form/data module and see
> what's going over the wire. Possibly it's all about how many records are
> being fetched from the server.

Thanks for the tip.
When I select "Row" chackbox (I think this is the one, that shows
fetched records) I got a lot of output. Analizing it showed, what I've
expected: almost identical output, but the first Open() seems to do more
at the beginning.
In both cases I do DisableControls() before Open()/Refresh() and
EnableControls() after it. I think this should pervent fetching a lot of
records (resut is displayed on a grid).
I mesured time of Open()/Refresh() only (call C's clock() immediatly
before and after a call to Open()/Refresh() and calculate the difference
between them), I get a difference, that shows, that first Open() is
usually faster. As I told, in one case I get a very big difference.

Any other ideas?

--
Aurimas