Align the time to minutes, use the max operator to aggregate and calculate the data at an interval of 1 minute, and then use SQL to calculate the maximum values of metrics of different instances.
SQL
*| SELECT __time_nano__ FROM "metrics_store_name.prom" WHERE __name__ = 'process_resident_memory_bytes' and element_at(__labels__, 'instance')='x-abcd'