Board index » delphi » Delphi 4, Tquery+TupdateSql too slow, Tquery error

Delphi 4, Tquery+TupdateSql too slow, Tquery error

I've used oracle 8i for NT and Delphi 4 (all updates+oracle driver).

If I try to insert a lot number of row with Tquery + TupdateSql (Cache
update), the process become too slow after 20 or 30 rows.
Data controls=dbgrid. All record show at the Tdbgrid.

If I try insert a row with Tquery(cache update), the first record will
show duplicate at
the TdbGrid.

If I try insert a row with Tquery(without cache update), the record will
not show
at the TdbGrid (I have to refresh).

TTable is slow. I don't want to use it.

And I founded that Tquery without TupdateSql is better because
TupdateSql will slow down the process.

Please your suggestion, about this problem.

Thank's All.

 

Re:Delphi 4, Tquery+TupdateSql too slow, Tquery error


Mr Cool ,

I don't know why you are getting the double row in the grid. Perhaps
someone else can help you there. But for the rest....

The local cache grows with every change you make to the data and those
changes stay in the cache until you refresh the query (Close/Open).

If you are using the grid to enter new data, then you can enter as
many records as you like and then, after you enter all the records you
want, update the data with ApplyUpdates. You should need to say this
only once after you enter all the records. This approach should show
you almost no degradation of performance.

If you are using cached updates in your code to move a lot of data
from one place to another, it's always a good idea to ApplyUpdates and
then Close and Open the query after every 10 records or so.

But if you ApplyUpdates and make more changes without closing and
opening the query, the cache will grow. The cache doesn't have any
indexes, so the only way to read this file is sequentially. As with
any sequential file, the larger it gets, the longer it takes to read
it.

Good luck.

Philip Cain

--

Re:Delphi 4, Tquery+TupdateSql too slow, Tquery error


Try insert record (10000 Looping) with  Tquery( cache)+TupdateSql and
Tquery(cache).
Use applyupdate; commitupdate;

I think Tquery( cache)+TupdateSql have an error because it doesn't release
the memory after commitupdate. But It's different if you use TQuery
(Cache).

Please any comment.

Quote
Philip Cain wrote:
> Mr Cool ,

> I don't know why you are getting the double row in the grid. Perhaps
> someone else can help you there. But for the rest....

> The local cache grows with every change you make to the data and those
> changes stay in the cache until you refresh the query (Close/Open).

> If you are using the grid to enter new data, then you can enter as
> many records as you like and then, after you enter all the records you
> want, update the data with ApplyUpdates. You should need to say this
> only once after you enter all the records. This approach should show
> you almost no degradation of performance.

> If you are using cached updates in your code to move a lot of data
> from one place to another, it's always a good idea to ApplyUpdates and
> then Close and Open the query after every 10 records or so.

> But if you ApplyUpdates and make more changes without closing and
> opening the query, the cache will grow. The cache doesn't have any
> indexes, so the only way to read this file is sequentially. As with
> any sequential file, the larger it gets, the longer it takes to read
> it.

> Good luck.

> Philip Cain

> --

Re:Delphi 4, Tquery+TupdateSql too slow, Tquery error


Mr Cool,

I don't know what you mean when you say "it doesn't release the
memory." What memory?

Also, I don't understand the difference between TQuery + TUpdateSQL
and just TQuery. What are the differences in your code?

Phil Cain

Quote
>Try insert record (10000 Looping) with  Tquery( cache)+TupdateSql and
>Tquery(cache).
>Use applyupdate; commitupdate;

>I think Tquery( cache)+TupdateSql have an error because it doesn't release
>the memory after commitupdate. But It's different if you use TQuery
>(Cache).

>Please any comment.

--

Re:Delphi 4, Tquery+TupdateSql too slow, Tquery error


Re:Delphi 4, Tquery+TupdateSql too slow, Tquery error


Yes Mr Cool is right!
When use TQuery+TUpdateSQL and after call DataBase.ApplyUpdate, the cache
can not be cleared. This problem has disturbed me for a week. Who can help
us?
Please!!!
Thank you!

Mr Cool D?o

Quote
> I've used oracle 8i for NT and Delphi 4 (all updates+oracle driver).

> If I try to insert a lot number of row with Tquery + TupdateSql (Cache
> update), the process become too slow after 20 or 30 rows.
> Data controls=dbgrid. All record show at the Tdbgrid.

> If I try insert a row with Tquery(cache update), the first record will
> show duplicate at
> the TdbGrid.

> If I try insert a row with Tquery(without cache update), the record will
> not show
> at the TdbGrid (I have to refresh).

> TTable is slow. I don't want to use it.

> And I founded that Tquery without TupdateSql is better because
> TupdateSql will slow down the process.

> Please your suggestion, about this problem.

> Thank's All.

Re:Delphi 4, Tquery+TupdateSql too slow, Tquery error


Quote
mmm <e...@mail.tjgl.com.cn> wrote:
>Yes Mr Cool is right!
>When use TQuery+TUpdateSQL and after call DataBase.ApplyUpdate, the cache
>can not be cleared. This problem has disturbed me for a week. Who can help
>us?

mmm,

"The cache can not be cleared" is not a clear explanation of a
problem. If you mean that the DEL*.MB files remain after ApplyUpdate,
then you are correct. To clear those, you have to close the query.

Phil Cain
--

Re:Delphi 4, Tquery+TupdateSql too slow, Tquery error


Thank you for your answer.
What I mean is that the memory that the cache used can not be freed.
Sorry for my poor English.
Thanks again.

Philip Cain D?o

Quote
> mmm <e...@mail.tjgl.com.cn> wrote:

> >Yes Mr Cool is right!
> >When use TQuery+TUpdateSQL and after call DataBase.ApplyUpdate, the cache
> >can not be cleared. This problem has disturbed me for a week. Who can help
> >us?

> mmm,

> "The cache can not be cleared" is not a clear explanation of a
> problem. If you mean that the DEL*.MB files remain after ApplyUpdate,
> then you are correct. To clear those, you have to close the query.

> Phil Cain
> --

Other Threads