DB rewrite