Accessing the database
Table of Contents
The AI-Framework has automated most parts of access to the database. When switching databases, the model does not need to change.
The AI-Framework itself
The way the AI-Framework accesses the database, based on instructions in the model, is fully optimised. However, when new improvements are discovered, they will be implemented in the AI-Framework and be made available in new releases.
The developer
Although the AI-Framework will be fast and efficient, accessing the database, the way the model is developed has impact as well.
Let's take as an example the counting of the number of customers that has an average number of orders per year of between 10.000 and 20.000 Euros. This number of clients, should be available at the click of a mouse. In our example, let's assume the database consists of 250.000 customers with an average order rate of 25 orders per month.
- One way to go about this to load all customers and their orders in memory (entity) and then do the math.
This is the slowest way to do this, because- it loads a lot of data in memory that is not needed (like names and article names),
- processing data in C# is slower than on the level of the database.
- The second way is to select and count the data on the database itself.
This is much faster, because- the data is processed on the database server and does not need to be downloaded to the application,
- the software on the database server is specialised in fast selecting and counting records.
- The third way is to split up the process, which is possible when the information can be one day "old" and does not have to be live.
- A stored procedure (software running on the database server itself) runs every night and does the selecting and counting.
- The results of this is stored in a separate table.
- When clicking "the button", the value from this table is collected and displayed. The necessary calculation has already been done overnight.