I am wondering, why queries with IN-Operator are much slower than a simple SELECT
.
Let me demonstrate my oberservations on an example:
Query1: SELECT VIDEO_ID FROM videos (about 8000 rows with 1 column)
Query2: DELETE FROM video_snapshot WHERE video_snapshot.VIDEO_ID IN (Query1)
video_snapshot is a very big table with over 7.000.000 rows but VIDEO_ID is indexed, so querys with VIDEO_ID in a WHERE
-clause are fast enough.
How does the IN
-Operator work? I guessed that this is just a short form for serveral WHERE
clauses.
I am using MariaDB 10.1.16 on XAMPP