XF 2.2 Possible to do a query against exif_data in xf_mg_attachment_exif?


Well-known member
XFMG stores the images EXIF data as a JSON array in the mediumblob column exif_data in the table xf_mg_attachment_exif. Is it possible to do a query directly that column to find matching values (eg: query to find all rows where 'model' = Nikon D700) or is the only way of doing it would be to loop through each row and decode & compare the values in the loop?
Depends on your MySQL version. Later versions do have JSON support that allows you to execute queries on JSON fields, but especially for large tables, performance will still be abysmal. If you want to regularly and dynamically query this information, e.g. to build a frontend view that shows all Pictures taken by a specific camera model, you'll be better off breaking this information out into a separate table with individual columns to query it efficiently
Top Bottom