Skip to content

Commit 9c67efc

Browse files
committed
improve
1 parent 0f71956 commit 9c67efc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

201807/20180703_02.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ select id from t_item2 where country='china' and (least(price1*ratio,price2*rat
320320
(7 rows)
321321
```
322322

323+
## 小结
324+
第一种设计,简化了程序开发,但是无法使用索引扫描,性能会比较差。
325+
326+
第二种设计,当调价比例、原价、折扣数据发生变化时,程序需要维护价格的变更到t_item1表,程序开发上会增加一定的负担,(当然也可以使用数据库触发器来更新,程序偷一下懒,但是不推荐这么做)。
327+
323328
## 参考
324329
[《PostgreSQL 函数式索引使用注意 - 暨非immutable函数不适合索引的原因》](../201807/20180703_01.md)
325330

0 commit comments

Comments
 (0)