Complex SQL query - need help
Create one or more new tables that capture the data in event_rules in a more useable form.  Then materialize those tables from the existing table.    Without more details, I can't say exactly what those tables should look like.  But here are two design problems that ought to be solved:

The column for allowable values violates first normal form, because it contains a list of values.  Decompose the tables in order to achieve first normal form, and create the right indexes to speed up the join that will be required to recompose the data.

The column for target table contains metadata.  In general, mixing metadata with data creates a confusing mess, unless you really know what you aere doing.  Consider decomposing the event_rules table into separate tables for each target table.  This looks complicated, but the resulting queries will be much much simpler, and probably faster.