dbTalk Databases Forums  

how can i improve this statement?

comp.databases comp.databases


Discuss how can i improve this statement? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default how can i improve this statement? - 08-03-2006 , 04:04 AM






I want to append a word to a TEXT field.

so I use:

UPDATE my_table SET my_text=concat(my_text,"a word") WHERE ...

this statement will be repeated for millions of times, and my_text has
contained maybe 50K characters.

It works too slowly. How can I impove it?

thanks.


Reply With Quote
  #2  
Old   
Jim Kennedy
 
Posts: n/a

Default Re: how can i improve this statement? - 08-03-2006 , 08:07 AM







<lionchao (AT) gmail (DOT) com> wrote

Quote:
I want to append a word to a TEXT field.

so I use:

UPDATE my_table SET my_text=concat(my_text,"a word") WHERE ...

this statement will be repeated for millions of times, and my_text has
contained maybe 50K characters.

It works too slowly. How can I impove it?

thanks.
Is the text a constant? Is it easy to specify what rows as a set?
For example if you update row by row it will be very slow. If you can
update many rows at the same time it will be much faster. eg
update my_table set my_text=my_text||"a word";
Jim




Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: how can i improve this statement? - 08-06-2006 , 06:24 AM




Thank you for reply. The additional word is different for each row.

Jim Kennedy wrote:
Quote:
lionchao (AT) gmail (DOT) com> wrote in message
news:1154595888.813742.217060 (AT) i42g2000cwa (DOT) googlegroups.com...
I want to append a word to a TEXT field.

so I use:

UPDATE my_table SET my_text=concat(my_text,"a word") WHERE ...

this statement will be repeated for millions of times, and my_text has
contained maybe 50K characters.

It works too slowly. How can I impove it?

thanks.

Is the text a constant? Is it easy to specify what rows as a set?
For example if you update row by row it will be very slow. If you can
update many rows at the same time it will be much faster. eg
update my_table set my_text=my_text||"a word";
Jim


Reply With Quote
  #4  
Old   
Michael Zedeler
 
Posts: n/a

Default Re: how can i improve this statement? - 08-06-2006 , 01:47 PM



lionchao (AT) gmail (DOT) com wrote:
Quote:
Thank you for reply. The additional word is different for each row.
There is a chance that some database genious will provide a short
circuit to do this faster, but my impression is that you're close to the
limit of what performance, you can expect.

If you need to be able to do something like this, another way of getting
it done, is to represent the text in some other way in the database,
making it faster (but possibly more complicated) to add words. This all
depends on the actual use.

Regards,

Michael.

P.s. please don't top post.
--
Which is more dangerous? TV guided missiles or TV guided families?
I am less likely to answer usenet postings by anonymous authors.
Visit my home page at http://michael.zedeler.dk/


Reply With Quote
  #5  
Old   
AT
 
Posts: n/a

Default Re: how can i improve this statement? - 08-06-2006 , 10:40 PM



I think the key point of this statement is that it should read all the
words out and then write them in.

Is there an SQL statement like "APPEND"?


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.