Re: update query taking too long

Поиск
Список
Период
Сортировка
От Chris
Тема Re: update query taking too long
Дата
Msg-id 46835737.8090307@gmail.com
обсуждение исходный текст
Ответ на Re: update query taking too long  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-performance
A. Kretschmer wrote:
> am  Thu, dem 28.06.2007, um 16:16:50 +1000 mailte Chris folgendes:
>> Is there a better way to write the update? I thought about something
>> like this (but couldn't get it working - guess I don't have the right
>> syntax):
>>
>> update t1 set domainname=(select id, SUBSTRING(emailaddress FROM
>> POSITION('@' IN emailaddress)) from table t2) AS t2 where t1.id=t2.id
>
> test=# select * from foo;
>  id |    mail     | domain
> ----+-------------+--------
>   1 | foo@foo.tld |
>   2 | bar@bar.tld |
> (2 rows)
>
> test=*# update foo set domain=SUBSTRING(mail FROM (POSITION('@' IN
> mail)+1));

That's what my original query is (apart from the +1 at the end) ;)

I was just trying to approach it differently with the other attempt.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: update query taking too long
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: update query taking too long