Med en Join-forespørgsel som denne har jeg de samme resultater, og den virker :) ved stadig ikke, hvorfor de indlejrede forespørgsler tog op til 40-50 sekunder. Tak til brugeren Dibakar Paul, som hjalp mig!
$sql1 = "Select distinct title, artist, album
from songs where id not in(Select distinct song.id
from songs song inner join playlist playlist
on playlist.song_id=song.id
inner join playlists playlists
on playlists.playlist_id=playlist.playlist_id
and playlists.name = '$playlist_name')";
$sql2 = "Select distinct song.title, song.artist, song.album
from songs song inner join playlist playlist
on playlist.song_id=song.id
inner join playlists playlists
on playlists.playlist_id=playlist.playlist_id
and playlists.name = '$playlist_name'";