Using exception with pg_total_relation_size for better performance
Using exception with pg_total_relation_size for better performance

IF EXISTS is too slow, one order of magnitude, than using exception
handling. In combination with thousands of tables to check total
relation size that's a problem.

Exception handles specifically undefined_table as it was the original
issue but also any other exception to guarantee a size is always
returned and no error is raised.

CartoDB/cartodb-postgresql,CartoDB/cartodb-postgresql