Database design 数据库设计-我应该使用哪种设计?两种选择

Database design 数据库设计-我应该使用哪种设计?两种选择,database-design,postgresql,Database Design,Postgresql,我正在使用PostgreSQL设计一个数据库模式。我对我应该使用哪种设计有一些疑问 表tdir\u details\u uris\u text将有数百万个寄存器,每个键domain,uri,id\u language将有大约10/20个寄存器 哪种设计应该表现良好?3张桌子的设计还是2张桌子的设计 致以最良好的祝愿 PS:对不起,我的英语很差 更新:只是在示例中添加一个INSERT insert into tdir_details_uris_text (domain, uri, id_la

我正在使用PostgreSQL设计一个数据库模式。我对我应该使用哪种设计有一些疑问

tdir\u details\u uris\u text
将有数百万个寄存器,每个键
domain
uri
id\u language
将有大约10/20个寄存器

哪种设计应该表现良好?3张桌子的设计还是2张桌子的设计

致以最良好的祝愿

PS:对不起,我的英语很差


更新:只是在示例中添加一个INSERT

insert into tdir_details_uris_text (domain, uri, id_language, id_categorie, id_data, id_ordinal, n_text) values ('motors.shop.ebay.com', 'http://cgi.ebay.com/ebaymotors/2009-FORD-MUSTANG-GT-BLACK-BEAUTY-16K-MILES-WOW-/230580626087?pt=US_Cars_Trucks&hash=item35afad22a7', 'en', '23', 'title_webpage', '1', '2009 Ford Mustang GT');
insert into tdir_details_uris_text (domain, uri, id_language, id_categorie, id_data, id_ordinal, n_text) values ('motors.shop.ebay.com', 'http://cgi.ebay.com/ebaymotors/2009-FORD-MUSTANG-GT-BLACK-BEAUTY-16K-MILES-WOW-/230580626087?pt=US_Cars_Trucks&hash=item35afad22a7', 'en', '23', 'highlights', '1', 'No Accidents / Damage Reported to CARFAX');
insert into tdir_details_uris_text (domain, uri, id_language, id_categorie, id_data, id_ordinal, n_text) values ('motors.shop.ebay.com', 'http://cgi.ebay.com/ebaymotors/2009-FORD-MUSTANG-GT-BLACK-BEAUTY-16K-MILES-WOW-/230580626087?pt=US_Cars_Trucks&hash=item35afad22a7', 'en', '23', 'highlights', '2', 'No Airbag Deployment Reported to CARFAX');
insert into tdir_details_uris_text (domain, uri, id_language, id_categorie, id_data, id_ordinal, n_text) values ('motors.shop.ebay.com', 'http://cgi.ebay.com/ebaymotors/2009-FORD-MUSTANG-GT-BLACK-BEAUTY-16K-MILES-WOW-/230580626087?pt=US_Cars_Trucks&hash=item35afad22a7', 'en', '23', 'highlights', '3', 'Vehicle Qualifies for the CARFAX Buyback Guarantee');
insert into tdir_details_uris_text (domain, uri, id_language, id_categorie, id_data, id_ordinal, n_text) values ('motors.shop.ebay.com', 'http://cgi.ebay.com/ebaymotors/2009-FORD-MUSTANG-GT-BLACK-BEAUTY-16K-MILES-WOW-/230580626087?pt=US_Cars_Trucks&hash=item35afad22a7', 'en', '23', 'highlights', '4', 'No Structural/Frame Damage Reported to CARFAX');
insert into tdir_details_uris_text (domain, uri, id_language, id_categorie, id_data, id_ordinal, n_text) values ('motors.shop.ebay.com', 'http://cgi.ebay.com/ebaymotors/2009-FORD-MUSTANG-GT-BLACK-BEAUTY-16K-MILES-WOW-/230580626087?pt=US_Cars_Trucks&hash=item35afad22a7', 'en', '23', 'highlights', '5', 'No Manufacturer Recalls Reported to CARFAX');
insert into tdir_details_uris_text (domain, uri, id_language, id_categorie, id_data, id_ordinal, n_text) values ('motors.shop.ebay.com', 'http://cgi.ebay.com/ebaymotors/2009-FORD-MUSTANG-GT-BLACK-BEAUTY-16K-MILES-WOW-/230580626087?pt=US_Cars_Trucks&hash=item35afad22a7', 'en', '23', 'highlights', '6', 'No Indication of an Odometer Rollback');

听起来像是一种多对多的关系,需要三张桌子的设计

但我不认为这是你展示的设计。我看不到正确的主键关系

表A将ID_A作为主键

表B将ID_B作为主键


联接表AB将具有主键ID_A,ID_B;每个表都是表a和表B的外键。

听起来像是一个多对多关系,需要三个表的设计

但我不认为这是你展示的设计。我看不到正确的主键关系

表A将ID_A作为主键

表B将ID_B作为主键


联接表AB将具有主键ID_A,ID_B;每个表都是表a和表B的外键。

选项1中的“tdirs\U URI\U text”表没有我能看到的用途(如果整个设计中只有两个表)。要问的问题是“tdirs_uris_text”中的主键是否会在不同的表上多次使用(作为外键)。具体地说,“详细信息”表中的“URI”外键会多次出现吗?如果是这样的话,选择1更好,否则选择2更好。

选择1中的“tdirs\u uris\u text”表没有我能看到的用途(如果您在整个设计中只有两个表)。要问的问题是“tdirs_uris_text”中的主键是否会在不同的表上多次使用(作为外键)。具体地说,“详细信息”表中的“URI”外键会多次出现吗?如果是这样的话,选择1更好,否则选择2更好。

真正的问题是:哪种设计更适合模型和关系代数?始终从那里开始。tdir_detauls_uris_文本和tdir_uris_文本中都有域/url/id_语言的原因吗?乍一看,这似乎是模型中的一个缺陷。无论如何,我不确定要呈现的真正的“模型”。是一个多还是一个多,等等?真正的问题是:哪种设计更适合模型和关系代数?始终从那里开始。tdir_detauls_uris_文本和tdir_uris_文本中都有域/url/id_语言的原因吗?乍一看,这似乎是模型中的一个缺陷。无论如何,我不确定要呈现的真正的“模型”。是一个多还是一个多,等等?确保捕获该需求。您好,谢谢您的回复。我已经更新了一个插入到示例中的内容。哪个表中的主键不正确?向你致意,你好,谢谢你的回复。我已经更新了一个插入到示例中的内容。哪个表中的主键不正确?顺致敬意,