记录请求,响应数据库 [英] Logging request , response to Database

查看:96
本文介绍了记录请求,响应数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我需要记录交易请求和对数据库的响应

但是我应该将它们记录在一个表中同桌内的关系

或者最好有两张桌子(一张用于请求,另一张用于响应)?



问候,

解决方案

数据库设计没有确切的答案。它总是取决于你想做什么。你将如何使用这些数据?你预计每种数据有多少?一方面,如果他们在同一张桌子上获得报告,你就不需要工会,但如果你不需要经常工会,那么就把他们分开。如果他们将共享所有相同的字段,那么将它们保存在同一个表中。



基本上,答案取决于它。你必须决定。


这取决于响应与单个请求的关系。

1)关系:1个请求1个响应

一张桌子



2)关系:1个请求很多回复

两张桌子



请阅读以下内容:

关系数据库 [ ^ ]

数据库的关系模型 [ ^ ]

Dears,

I need to log transaction requests and responses to database
But shall I log them in a single table with a relationship within the same table
or it's better to have 2 tables (one for request and one for response) ?

Regards,

解决方案

Database design has no exact answer. It always depends on what you want to do. How will you use the data? How much data do you anticipate of each kind? On the one hand if they are in the same table to get a report you don't have to union but if you won't need to union often then keep them separate. If they will share all the same fields then keep them in the same table.

Essentially, the answer is it depends. You'll have to decide.


It depends on how response are related with single request.
1) Relationship: 1 request to 1 response
One table

2) Relationship: 1 request to many responses
Two tables

Please, read these:
Relational database[^]
Relational model of database[^]


这篇关于记录请求,响应数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆