How do I optimize this?

Поиск
Список
Период
Сортировка
От Wei Weng
Тема How do I optimize this?
Дата
Msg-id 49C0198B.2050304@kencast.com
обсуждение исходный текст
Ответы Re: How do I optimize this?  (Wei Weng <wweng@kencast.com>)
Список pgsql-sql
Hi all.

I have the following scenario:

A table T (int t1; int t2; ... int t10; int tkey)
A table D (int da; int db),

And I have the following query
update T set t1 = b.aa FROM (select COUNT(1) as aa FROM D WHERE D.da = 
<count>) as b where tkey = <value>;
update T set t2 = b.aa FROM (select COUNT(1) as aa FROM D WHERE D.da = 
<count>) as b where tkey = <value>;
...
update T set t10 = b.aa FROM (select COUNT(1) as aa FROM D WHERE D.da = 
<count>) as b where tkey = <value>;

The queries are run on the same <value>. Is there anyway to optimize this???


Thanks
Wei





В списке pgsql-sql по дате отправления:

Предыдущее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: join
Следующее
От: Wei Weng
Дата:
Сообщение: Re: How do I optimize this?