How many tables in db?!

The number of tables == number of doctypes?!


Hi,

Yes, Each Doctype == Database Table. Also, there are other some other tables also.

Thanks,

Divyesh Mangroliya

Not necessarily. There are system tables related to the framework, also a doctype can have multiple db tables as ‘Table’ or ‘Table MultiSelect’ fields create its own db table, so if you have 5 such fields inside a doctype you’ll end up with 6 db tables.

what i found in db tables is less than doctypes
@mangroliya , @Adeel_Siddiqui

Your second query returns information about metadata tables of mariadb database instance, those have nothing to do with frappe framework. Run this query and you’ll see what I mean.

SELECT TABLE_NAME 
FROM information_schema.TABLES 
WHERE TABLE_SCHEMA = 'information_schema';

There are a few SQL tables that are not DocTypes:

  • __Auth
  • __FilterAttributes
  • __UserSettings
  • __global_search
  • perhaps a few more

Also there are DocTypes that do not have their own SQL Table. Mostly this happens when the DocType is marked as a “Single”. In that case, the data is stored in a shared table named 'tabSingles'. A good example is the DocType “System Settings”.

That is normal/okay.

2 Likes

To add what’s already been mentioned, the singles table includes doctypes that are of the single type. This table will have many entries for various single doctypes as each entry is for a single field.

Pretty much out of the box ERPNext 14 with HR app installed shows me:
873 tables where 852 of those start with “tab” which would indicated doctypes.

The same system has 1099 entries in tabSingles for ~68 unique docTypes.

1 Like

thx for all