Search code examples
databasedatabase-designlanguage-design

Database tables with only one index ... bad idea?


If a programming language allowed the creation of database tables, but only allowed one field to be used as an index ... how limiting would that be? I am not a real database programmer, so I'm wondering if such a system could be used as the basis for serious databases, or would be only a toy.


Solution

  • That would be extremely limiting. I've seen as many as 11 indexes on tables I've dealt with, all of them having a purpose. No doubt there are cases out there with substantially more.

    At a minimum in a database the primary key and all foreign keys will be (or should be) indexed.

    Also it's common for indexes to span multiple columns.