RecordCount and order by

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sysgamble
Posts: 7
Joined: Mon 23 Jul 2012 13:56

RecordCount and order by

Post by sysgamble » Fri 27 Jul 2012 20:25

I'm testing a trial version of odac in direct mode and i'm having some problems.

TOraQuery don't return the correct RecordCount of a Select.

Order by don't works.

Thanks in advance.

Delphi 7, odac 8.2.7.0, Win 7 64 professional

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: RecordCount and order by

Post by AlexP » Mon 30 Jul 2012 09:38

hello,

To make TOraQuery return a correct number of records that are returned in the query, you should either set the FetchAll property to True (in this case, all the records will be loaded to the DataSet, and you will get the correct number of records), or set the QueryRecCount property to true (in this case, before opening DataSet, an additional query will be executed: SELECT COUNT(*) FROM (YOUR QUERY) to find the number of records..
Please explain in more details (an example is desired) what do you mean by "Order by don't works."?

sysgamble
Posts: 7
Joined: Mon 23 Jul 2012 13:56

Re: RecordCount and order by

Post by sysgamble » Mon 30 Jul 2012 17:24

Sorry about order by, was a mistake.

I'm using just the TOraSession and TOraQuery. About FetchAll property, what is the difference between true or false? I mean, what is the impact in performance, speed, and things like that?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: RecordCount and order by

Post by AlexP » Tue 31 Jul 2012 08:40

hello,

When the FetchAll option is on, all data is fetched to the client, and, correspondingly, if the amounts of data are large, performance decreases. That's why it is recommended to turn this option on only when there is a real necessity (for example, when working in the Disconnect mode).
Also the value of the FetchRows property influences performance, because the size of the packets that are transferred through the network depends on this property. You can experiment with the value of this property (increase it) to increase the performance (Try setting this property value from 50 to 500).
The performance can depend on the types of fields that are available in the query. For example, if there are BLOB data fields in your query, obtaining of data can also take a lot of time.

sysgamble
Posts: 7
Joined: Mon 23 Jul 2012 13:56

Re: RecordCount and order by

Post by sysgamble » Tue 31 Jul 2012 12:03

I have just one more question, by now.

Like i said, i'm using just TOraSession and TOraQuery. There is something that i can do to incrase performance or to downsize the code?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: RecordCount and order by

Post by AlexP » Wed 01 Aug 2012 12:58

hello,

The application performance depends on various parameters, therefore a special approach is needed for each particular case to increase performance. For example, when working with BLOB fields, to increase performance, you should read the contents of BLOB fields when necessary only (the OraQuery.Options.DeferredLobRead option). As I wrote you before, the amount of records retrieved only once from the server also influence the performance, etc. The code size depends on your application tasks. For example, for an application, that only reads and edits data in a DB, it will be enough to customize data access and display components with no need to write code.

Post Reply