Plex DB where is the flag for --analyze-deeply

Perhaps this is better. BTW, I like to explicitly name the tables in the joins:

select meta.id from metadata_items meta
  join media_items media on media.metadata_item_id = meta.id
  join media_parts part on part.media_item_id = media.id
where part.extra_data not like '%deepAnalysisVersion=2%'
  and meta.metadata_type in (1, 4, 12)
  and part.file != "";

The last, part.file != "" is there because some metadata items reference remote files such as trailers and other extras. I select the metadata item id since that is the ID you give to the deep analysis.