New AdoRdd at
Performance enhancement opening tables.
SET RECORDSET OPEN WHERE CLAUSE TO {{"MYTABLE","HBRECNO < 51000" },;
{"MYTABLE2","HBRECNO BETWEEN 1 AND 50000" }}
This SET together ADOWHERECLAUSE( nWa, cNewSql ) enable us to open tables using the set of data we really need without altering any code logic.
This SET is used as default query to open for each table present here.
The ADOWHERECLAUSE( nWa, cNewSql ) can be placed in strategic places within our app code to change or to avoid to bring all the records to the set.
Tables till 100K dont need to worry.
Usually its slower to build the set than to read data from the database.
Recordset s with more than 100 columns will start to take long time to build.
I´ve seen recordset s with 800 columns! This takes long time even with a couple of thousands of records!
Tables with a couple of millions of records if we dont use any WHERE clause will exhaust memory very fast or we even dont have enough memory to run our app.
[code=fw:3qcom0m3][/code:3qcom0m3]
Caching the tables (recordsets):
[code=fw:3qcom0m3][/code:3qcom0m3]
This enable to cache the tables to avoid read the data again every time we open these tables
with the same query.
This SET uses the queries defined with SET RECORDSET OPEN WHERE CLAUSE TO.
Setting TO 0 adordd will not cache any table based on nr of records.
In this case adordd will only load the tables in MASK.
In databases with tables of millions of records if we choose to cache tables for ex > 50k records we must have a defined query for those tables otherwise adordd will cache all the records in the table.
If there are 10.000k program most probably will crash!
We need also to pay some attention to MASK to avoid loading tables we dont need.
Suppose that we have loaded, when we import our data on our database, our tables with paths:
These will be the table names in the database.
CURRENTPATH_MYTABLE
HISTORICOATH_MYTABLE
With above SET adordd will cache both.
So in this case we can do:
SET ADO PRE OPEN THRESHOLD TO 0 MASK {"CURRENTPATH\MYTABLE","CURRENTPATH\MYTABLE2"}
To avoid cache for ex other historic tables with same name.
Please remember that even we dont use this SET every time a table is opened it will be cached.
Again if any of those tables have millions of records if we dont have any query to limit the nr of records returned adordd will load all those millions!
ATTENTION
By default adordd caches all tables with more than 6000 recs when opening it.
Please adjust it in adordd to another value of your choice and we should have a query to limit records
for the tables with more than 500k.
↧