I have two tables users, and postmeta. I want to take users id's from users table and want to filter users id's which are not present in postmeta table.
Here is my mysql query
SELECT u.ID from users WHERE u.ID NOT IN (SELECT DISTINCT(meta_value) from postmeta WHERE meta_key = '_customer_user')
Above query is working fine but as i have thousands of users and also postmeta table is large it is taking too much time.
Can anyone help me on how to optimize this query?