**6. Conclusions**

In this work, a similarity between the problem of selecting indexes and materialized views with the Knapsack algorithm was proposed. The contributions are: The first level, the use of the backpack algorithm to present this problem as well as a mathematical modeling, then the use of machine learning to reduce the execution time of the workload. For this, two tables were used to ensure that the optimal configuration remains reliable even after updating the database. To validate this approach, an algorithm developed in python.

#### **Acknowledgements**

this work is the result of two works published as part of a Tunisian-South African research project (Grant Numbers: 113340, 120106) funded by the Ministry of Higher Education and Scientific Research and the National Research Foundation of South Africa presented by Prof Qing-Guo WANG.

#### **Author details**

deletion) the trigger does the same operation on the object concerned (Index or MV). For example, if a new row is inserted in the Table Ti, the trigger inserts the same row in the index and the VM linked by the table Ti. After each iteration, if the size of the configuration exceeds S or if the solution has become non-optimal,

T1 T1 T3 T4 T5 T6

v1 0 0 1 0 1 0 v2 1 1 0 1 0 1 v3 0 0 0 0 0 0 v4 1 0 1 1 1 0 v5 0 0 0 1 0 1

*Wireless Sensor Networks - Design, Deployment and Applications*

This architecture guarantees that all the indexes and MVs form the optimal

Algorithm 1 must be restarted.

*Algorithm of the dynamic approach.*

*10. While (true) do 11. task trigger() 12. lock false 13. if(task) then 14. lock true*

*Output: Config*

*Start*

**220**

**Figure 5.**

**Table 4.** *Matrix VT.*

configuration even after updating the Workload.

*15. {I, MV} get\_structure (Tables)*

*16. Update(Config(I,MV))*

**Algorithm 2**. Dynamic database.

*Input: Index I, MV,Tables, Workload*

*Initialization: task*!*{Ø}, lock=false*

Kamel Abbassi\* and Tahar Ezzedine Communication System Laboratory Sys'com, National Engineering School of Tunis, University Tunis El Manar, PB 37, Belvedere, 1002, Tunis, Tunisia

\*Address all correspondence to: kamel.abbassi@enit.utm.tn

© 2021 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/ by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
