The local H2 database is not suitable for large datasets. It is a java process which keeps all records in memory.
If you want to test with 1M records, the best way to do this is to install postgresql on your laptop. Configure your app to connect to the local postgres in the setting window. You should have no problem running 1M records or more with Postgres. With this amount of data it is also important to have the right indexes on your attributes, you can configure this in the entity dialog.
I find the easiest way to run postgres is by using docker compose. You can use the following docker-compose.yml configuration file to start postgres:
Is this something you will need for user requirements or just testing you are doing? If your users are requesting on page access to 1,000,000 records, I think you may need to understand better what they are trying to accomplish.
You can provide search capabilities with the datagrid and set the datagrid to wait for search, which will give your users access to all database records via search criteria. Maybe that meets their requirements?