If you're facing this particular issue, the ideal solution is to implement lazy loading for your data.
I have two recommendations for you:
Integrate Pagination into the table. This way, only a few records will be loaded initially, and the rest will load based on the page selected by the user.
Pseudo Code:-
//Step 1 :- Divide the data into chunks, for example, if you want to split it into 3 pages, each page should have 20000/3 records.
//Step 2:- Show the records from the respective chunk based on the page clicked by the user.
Incorporate Infinite scrolling in the table so that the user sees some records fitting the screen height, with extra data loading as they scroll. You can also preload additional data for seamless scrolling.
Pseudo Code:-
//Step 1 :- Determine the viewport height (portion of the screen visible to the user), and load records compatible with this height. Additionally, load a few extra records. For instance, if the screen displays only 40 records at once, initially load 45 records on the screen.
//Step 2:- Continuously listen to the scroll event to add the next set of 45 records/rows to the table as the user scrolls further.
Code snippet to listen for scroll events and load more data-->
const div = document.querySelector("#div-container-for-table");
div.addEventListener("scroll", () => {
if (div.scrollTop + div.clientHeight >= div.scrollHeight) loadMore();
});
Infinite scroll Example
Pagination Example
I suggest opting for the second option as it offers a more user-friendly experience without requiring any additional clicks.