Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Estimated count from table stats (MySQL)
def count_from_table_stats(klass)
result = klass.connection.execute("show table status like '#{klass.table_name}'")
result.first[result.fields.index("Rows")]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment