小编har*_*rog的帖子

PostgreSQL JSONB 与保留单独的表

我正在考虑数据库设计,想知道是否有人可以插话。我有一些结构化数据,我偶尔会过滤一些非结构化数据。我对性能思考了很多,所以我试图尽可能使其非规范化。人们对单独表上的索引 JSONB 列有意见吗?例如:

| (smurfs) id | name   | filters (GIN index)                 |
|-------------+--------+-------------------------------------|
|           1 | Papa   | { "color": "blue" }                 |
|           2 | Brainy | { "brain": "big", "color": "blue" } |
Run Code Online (Sandbox Code Playgroud)

我会查询索引的 JSONB 数据。

或者:

| (smurfs) id | name   |
|-------------+--------+
|           1 | Papa   |
|           2 | Brainy |

| (filters) id | smurf_id | filter_type | filter_value |
|--------------+----------+-------------+--------------|
|            1 |        1 | color       | blue         |
|            2 | …
Run Code Online (Sandbox Code Playgroud)

database postgresql database-design jsonb postgresql-9.4

5
推荐指数
0
解决办法
1000
查看次数

gRPC设置问题。出现间歇性RPC不可用错误

我有一个grpc服务器和客户端,大多数时候都能正常工作,但是偶尔会收到“传输正在关闭”错误:

rpc error: code = Unavailable desc = transport is closing
Run Code Online (Sandbox Code Playgroud)

我想知道我的设置是否有问题。客户端很基础

connection, err := grpc.Dial(address, grpc.WithInsecure(), grpc.WithBlock())
pb.NewAppClient(connection)
defer connection.Close()
Run Code Online (Sandbox Code Playgroud)

并以类似超时的方式拨打电话

ctx, cancel := context.WithTimeout(ctx, 300*time.Millisecond)
defer cancel()

client.MyGRPCMethod(ctx, params)
Run Code Online (Sandbox Code Playgroud)

我正在做的另一件事是检查连接以查看它是处于打开,空闲还是正在连接状态,如果有则重新使用该连接。否则,请重拨。

服务器没有任何特殊配置

grpc.NewServer()
Run Code Online (Sandbox Code Playgroud)

设置我可能正在设置的grpc客户端/服务器是否存在任何常见错误?

rpc go grpc

5
推荐指数
2
解决办法
4257
查看次数

标签 统计

database ×1

database-design ×1

go ×1

grpc ×1

jsonb ×1

postgresql ×1

postgresql-9.4 ×1

rpc ×1