Hi Chris, I am writing to give you an update on the progress that I have made. I've created a temporary table named temp_package_metadata[1] and insert a revision that already in my local database[2]. Then as you said I've run the slow query with EXPLAIN ANALYZE. (screenshot is attached) I may understand the slow query's working logic. [1]CREATE TEMPORARY TABLE temp_package_metadata (LIKE package_metadata INCLUDING ALL) [2]INSERT INTO temp_package_metadata (home_page, location_id,license_set_id,package_description_set_id, package_synopsis_set_id) VALUES ('https://zlib.net/',9,9,2373,1407) Now, I'm looking into a specific issue that arises when called insert-missing-data-and-return-all-ids. Thanks, Canan Talayhan