I am working on a project, where I need to store the information related to A and B, the A and B both have identical columns.There might be thousands of As and Bs. Should I use "type" column to differentiate between these two ? Is there any performance issue because each time it will require a full table search ? I have 3 tables that are having similar structure for A and B.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Indexes which are not very selective are usually ignored by the query optimization engine. If you have roughly equal numbers of A's and B's then an index on either won't help you. If you want to filter by this type, then that part of the query will involve a scan.
However, if you don't have some more selective filter criteria on other columns, then you are looking at scans anyway, so there is no real additional penalty for keeping the A's and B's together.
Whether you keep them together or apart should depend on whether they are semantically related, not whether they have (coincidentally) identical columns.