Subject | Re: Which way is best... |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-11-11T10:51:56Z |
How do you decide the new field value? I guess e.g.
INSERT INTO MyTable (FieldA, FieldB, FieldC)
SELECT FieldA, FieldB, FieldC+4000000
FROM MyTable
WHERE FieldC < 300000
would be quicker than doing each record individually. Though a side
effect could be consuming the CPU 100% for that shorter period of
time, meaning that interactive users could feel the system wasn't
responsive (at least with SuperServer).
Set
INSERT INTO MyTable (FieldA, FieldB, FieldC)
SELECT FieldA, FieldB, FieldC+4000000
FROM MyTable
WHERE FieldC < 300000
would be quicker than doing each record individually. Though a side
effect could be consuming the CPU 100% for that shorter period of
time, meaning that interactive users could feel the system wasn't
responsive (at least with SuperServer).
Set
--- In firebird-support@yahoogroups.com, "Michael Vilhelmsen" wrote:
> Hi
>
> According to my earlier postings, I would like to know which way is
> best.
>
> I have a table, containing some 4 mill. records.
> Each records has several varchars, date, numeric and integer fields.
> I have to insert around 300.000 more, which will be almost identical
> to some other 300.000 except for 1 field.
>
> What I do now is
>
> Select
> Fields I need
> from table
> where
> some condition
>
>
> Then I iterate through to dataset and insert 1 record for each
> record.
>
> How do I do that the best way ?
>
> Michael