标签: bash postgresql loops for-loop
我有这种代码需要很长时间才能在数据库的所有表上循环。我如何使其更快?
for i in $tables : do results_one=$(psql database -tAc "SELECT distinct(pg_xact_commit_timestamp(xmin)) FROM $i where and pg_xact_commit_timestamp(xmin) >= NOW() - INTERVAL '5 minutes' ") done