【发布时间】:2013-04-16 21:59:45
【问题描述】:
问题
- 我有两个数据库 user_works 数据库和定价数据库。
- 我想加入两个表 user_table 这是在 user_works 使用 user_id 在定价数据库中的数据库和rent_table
到目前为止我做了什么
- 我第一次调用 user_works db。
- 从 user_table 中获取 id。
- 然后将 id 传递给定价数据库中的rent_table
例子:
$user_id = select user_id fron user_table WHERE name=abc
将 $user_id 传递给 dbObject user_works db 并获取用户 ID
$rent = select user_id,rent from rent_table WHERE user_id IN ( $user_ids )
将 $rent 传递给定价数据库的 dbObject 我想在 php 应用程序中执行此操作
有没有更好的方法来做到这一点。定价数据库真的很重吗?比如使用临时表等。
【问题讨论】:
-
我正在使用 postgresql
-
什么是“diff 数据库”?
标签: sql postgresql optimization query-optimization