The present invention provides a method for optimizing the
memory performance of a
database, an electronic device, and a storage medium, which are applied to the field of
database technology. The method includes: mounting the storage-class memory as a
data memory heap, initializing it and setting it to the memory mode; when reading the data of a certain table for the first time, the data block is loaded from the disk into the
data memory heap and marked as hot data. According to the LIRS mechanism, when the hot
data memory is full, some data blocks are converted into cold data; an asynchronous thread is started to monitor the cold data in the data memory heap. A release
signal is sent, and the thread reads the cold data and asynchronously writes it into the storage-class memory. When the data blocks in the storage-class memory are full, the cold data blocks are cleared according to the LIRS mechanism and written to the disk. When reading the data of a certain table again, first search the data memory heap, and then search the storage-class memory. If there is a
data cache, directly use it. If not, load it from the disk again, and loop to execute the operations of the first reading, thread monitoring, and again reading.