Improve performance of the record table assert.

Old query was making a lot of reads from the information_schema.  This
query is equivalent and cheaper.