Better local database queries