It takes hours to batch delete images if you have millions of images in your WordPress Media Library.
The following MySQL commands allow you to accomplish this in a few seconds. Please make a backup of the MySQL database before you execute the command.
First, execute the following MySQL command. It deletes the relationship between the media library attachments and the posts.
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT id FROM wp_posts WHERE post_type = 'attachment'; )
Next, run the following MySQL command to delete the attachments
DELETE FROM wp_posts WHERE post_type = 'attachment'