alter table pgbench_accounts add mtime timestamp default now(); create or replace function fill_mtime() returns trigger as $$begin NEW.mtime=now(); return NEW; END;$$ language plpgsql; create trigger t_accounts_mtime before update on pgbench_accounts for each row execute function fill_mtime(); create index accounts_mtime on pgbench_accounts (mtime, aid); create index fiver on pgbench_accounts ((aid - (aid%5))); create index tenner on pgbench_accounts ((aid - (aid%10))); create index score on pgbench_accounts ((aid - (aid%20))); ANALYZE pgbench_accounts;