Where to store the name of a custom table?

As long as…

  1. You use $wpdb->prefix (or $wpdb->base_prefix) to prefix the table
  2. Your table name is someplace public, and easily available for other plugins, themes and end users to use and extend

I would say either setting the table as a property on $wpdb or using a constant is fine. If you choose to use $wpdb be aware that another plugin (or theme or whatever) can just overwrite your property in the same way you set it. For that reason, it’s a bit more “safe” to use something like a constant.

Also, always carefully question whether or not you need to add a table.

I tend to use constants, but if I’m doing something like creating a termmeta table, then I would use a $wpdb property.