Database designs, parallel tables, or extra fields?

I run a database for a sequencing centre. There are other developers getting data out of this and running automated and semi automated processes from the database.

We are discussing a change to the database.

At the moment we have a library that has a one-to-one relationship with a multiplex_index, which can be used to identify the library. We now want to add an optional GBS_index to each library (another optional one-to-one relationship). So each library will have a multiplex_index and optionally a GBS_index.

The columns stored on the new GBS_index will be the same as for the multiplex_index. So we have 2 options for storing the GBS_index data.

1) Store the GBS_index data in the original multiplex_index table, and identifying it by its “type” field.

2) We can add a parallel table for the GBS_index, which mirrors the multiplex_index table.

I favour the second parallel table option, as I see it as less likely to break existing code (scripts query the database for a list of multiplex_indexes, these would need to exclude the GBL_indexes in this case).

Conceptually the two types of indexes are both “multiplex indexes”, but used in a slightly different manner.

Are there any strong arguments for or against either option?


Ok, a quick explanation of DNA sequencing may help.

DNA sequencing involves taking DNA from cells and splitting them up into “reads” of approx 200 base pairs (each base pair is like a DNA char A,T,G or C).

We load libraries (DNA from a prepared biological sample) on to a machine and sequence them. The two types indexes I talked about are a another piece of DNA with a known sequence, that is attached to the start of the library DNA before it is sequenced. That way, we can read the first bit of sequence we can identify what library each read (~200 chars) came from. (We are generally interested in the numbers of reads matching a position on a reference genome).

Now we can have one (multiplex) or two (multiplex + GBS) indexes at the start of the library DNA (one comes after the other), which form a unique combination to identify the library.

Initially two libraries with the same multiplex_index should not be loaded together, as you couldn’t identify them from the multiplex_index sequence. Now the combination of the two indexes should be unique.

5

Parrallel Table:
You are correct that using a new “parallel” table for GBS_index will be less likely to break existing processes. Even if you could reuse the old table without an extra type-field you would be changing the relationship from a 1-1 to a 1-many. This would be a breaking change.

The draw back is this design is not data driven. What if a 3rd type of index is introduced? 4th, 5th…. 20th? I’m not familiar with DNA but if the types can scale it would require a query change every time a new type is introduced. Adding a type with a parallel table may not be a “breaking” change but it would require a change nonetheless every time a type is introduced. Writing queries against 20+ tables would be cumbersome.

Add an extra type field:
This design would be a breaking change. You are changing the relationship from 1-1 to 1-many. But if the relationship really is 1-many then it “should” be modeled that way in the database.

This design is also data driven. Every time a new type is introduced you merely add data to the “type” lookup table. No query changes required (except for the initial change you are doing now of course).

Conclusion:
I prefer adding the extra field as it models the 1-many relation with a 1-many relationship in the database. The parallel table emulates a 1-many with multipe 1-1 relations and is not data-driven for new types in the future.

Both designs will work. It comes down to how critical and political a breaking change is. And whether the types are fixed at 2 or scale to N.

7

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Database designs, parallel tables, or extra fields?

I run a database for a sequencing centre. There are other developers getting data out of this and running automated and semi automated processes from the database.

We are discussing a change to the database.

At the moment we have a library that has a one-to-one relationship with a multiplex_index, which can be used to identify the library. We now want to add an optional GBS_index to each library (another optional one-to-one relationship). So each library will have a multiplex_index and optionally a GBS_index.

The columns stored on the new GBS_index will be the same as for the multiplex_index. So we have 2 options for storing the GBS_index data.

1) Store the GBS_index data in the original multiplex_index table, and identifying it by its “type” field.

2) We can add a parallel table for the GBS_index, which mirrors the multiplex_index table.

I favour the second parallel table option, as I see it as less likely to break existing code (scripts query the database for a list of multiplex_indexes, these would need to exclude the GBL_indexes in this case).

Conceptually the two types of indexes are both “multiplex indexes”, but used in a slightly different manner.

Are there any strong arguments for or against either option?


Ok, a quick explanation of DNA sequencing may help.

DNA sequencing involves taking DNA from cells and splitting them up into “reads” of approx 200 base pairs (each base pair is like a DNA char A,T,G or C).

We load libraries (DNA from a prepared biological sample) on to a machine and sequence them. The two types indexes I talked about are a another piece of DNA with a known sequence, that is attached to the start of the library DNA before it is sequenced. That way, we can read the first bit of sequence we can identify what library each read (~200 chars) came from. (We are generally interested in the numbers of reads matching a position on a reference genome).

Now we can have one (multiplex) or two (multiplex + GBS) indexes at the start of the library DNA (one comes after the other), which form a unique combination to identify the library.

Initially two libraries with the same multiplex_index should not be loaded together, as you couldn’t identify them from the multiplex_index sequence. Now the combination of the two indexes should be unique.

5

Parrallel Table:
You are correct that using a new “parallel” table for GBS_index will be less likely to break existing processes. Even if you could reuse the old table without an extra type-field you would be changing the relationship from a 1-1 to a 1-many. This would be a breaking change.

The draw back is this design is not data driven. What if a 3rd type of index is introduced? 4th, 5th…. 20th? I’m not familiar with DNA but if the types can scale it would require a query change every time a new type is introduced. Adding a type with a parallel table may not be a “breaking” change but it would require a change nonetheless every time a type is introduced. Writing queries against 20+ tables would be cumbersome.

Add an extra type field:
This design would be a breaking change. You are changing the relationship from 1-1 to 1-many. But if the relationship really is 1-many then it “should” be modeled that way in the database.

This design is also data driven. Every time a new type is introduced you merely add data to the “type” lookup table. No query changes required (except for the initial change you are doing now of course).

Conclusion:
I prefer adding the extra field as it models the 1-many relation with a 1-many relationship in the database. The parallel table emulates a 1-many with multipe 1-1 relations and is not data-driven for new types in the future.

Both designs will work. It comes down to how critical and political a breaking change is. And whether the types are fixed at 2 or scale to N.

7

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật