I have been using Docker for all my development projects since 2018. I bought an M1 Mac last year and have been facing performance issues while working on PostgreSQL containers. Some queries took up to 15 seconds at times.
After months of searching for solutions online, I have found the fix. It relies on two new features from Apple,
Docker has marked these features as experimental, which means they are NOT stable yet. You can enable these settings by going to Docker > Preferences > Experimental Features and checking the two options listed (See screenshot).
You might not see any performance boost until you have destroyed existing containers, removed associated volumes and re-provisioned them again.