Use your arrays as DB tables, and make queries on them.