Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

share|improve this question
    
IF you are using partitioning (say, with partitioning by 'type' column), it will scan only "A" or "B" partition (surely, it's in WHERE clause) –  a1ex07 Aug 17 '13 at 15:16
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.