Is there a way to speed up simple schema changes like ...
ALTER TABLE foo ADD COLUMN bar CHAR(64);
... where foo already contains millions of records?
On a live database changes like this can take hours. Even when the
database is idle.
Is there a better way to do this?
S.
--
"Stefan Arentz" <[EMAIL PROTECTED]> writes:
> Is there a way to speed up simple schema changes like ...
>
> ALTER TABLE foo ADD COLUMN bar CHAR(64);
>
> ... where foo already contains millions of records?
>
> On a live database changes like this can take hours. Even when the
> database is idle.
I have a question that I've thought in my head about using triggers, but
I figure to ask people that do SQL more than I. So, I have a table that
I want two columns.
(1) A featured column which is for only 1 row, once it switched to
another row than all other rows must be false
title
I was wondering if it is possible to set the 'context' for running an
sql command:
For example, say you have a rule which upon update to table TEST of
type [a int, b varchar(10), c varchar(50)]:
INSERT INTO Log(a * 5, substring(b,0,2), randomize(c))
So an update of (5, 'hello', 'world') will add
--- PostgreSQL Admin <[EMAIL PROTECTED]> wrote:
> I have a question that I've thought in my head about using triggers, but
> I figure to ask people that do SQL more than I. So, I have a table that
> I want two columns.
>
> (1) A featured column which is for only 1 row, once it switched to
> anoth
OOPS!
--- Richard Broersma Jr <[EMAIL PROTECTED]> wrote:
> CREATE UNIQUE INDEX Only_one_row_true
> ON Your_table ( featured )
>WHERE featured = true;
>
> Or if you want to only allow 1 featured article per catagory then:
>
> CREATE UNIQUE INDEX Only_one_row_true_per_catagory
>
> I was wondering if it is possible to set the 'context' for running an
> sql command
Oracle has a Context('varname') that returns the value of varname for
the session. to best of my knowledge pg has nothing like this.
> I guess bottom line, is it possible to execute a bunch of SQL
> statements
> --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote:
>
>> CREATE UNIQUE INDEX Only_one_row_true
>> ON Your_table ( featured )
>>WHERE featured = true;
>>
>> Or if you want to only allow 1 featured article per catagory then:
>>
>> CREATE UNIQUE INDEX Only_one_row_true_per_catag
Hello,
I have a scenario like this:
CREATE TABLE table1
(
id serial NOT NULL,
col1 character varying(30),
CONSTRAINT pk_table1 PRIMARY KEY (id)
);
CREATE TABLE table2
(
fk_table1 integer,
type1 character(3),
id serial NOT NULL,
CONSTRAINT pk_table2 PRIMARY KEY (id)
);
CREATE TABLE table
...
> When you say use rules to inject constants, how would I go about
> doing this? Could you maybe give a brief example?
create view tab1_dml as select * from tab1;
-- note:
-- CONSTANT1 = 8
-- CONSTANT2 = 15
create or replace rule tab1_insert as
on insert
to tab1_dml
do instead(
ins
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote:
> CREATE VIEW view1( id, col1, type1, type2) AS
> SELECT table1.id,
>table1.col1,
>CAST( table2.type1 AS CHARACTER( 3 )),
>NULL
> FROM table1
> JOIN table2 ON table2.fk_table1 = table1.id
> UNION ALL
> SELECT table1.id,
DT> As result, __new type of system information__ appears:
DT> field, refering to other field by foreign key,
DT> has additional bit except own value -
DT> bit specifies, whether record, to which it refers,
DT> is in the same or in other database.
DT> It's necessary to not signalize about break of
Expecting to save 4 seconds per query, I built a partial index on a
table, and was surprised that it did not work. Could someone explain
the difference between "foo=false" and "foo is false", for a boolean
type column?
stage=# create index eg_ve_reconciled_partial on eg_vehicle_event
(reconci
Bryce Nesbitt <[EMAIL PROTECTED]> writes:
> Could someone explain
> the difference between "foo=false" and "foo is false", for a boolean
> type column?
They give different results for NULL --- specifically, NULL for the
former and FALSE for the latter. Don't blame me, it's in the spec...
Tom Lane wrote:
Bryce Nesbitt <[EMAIL PROTECTED]> writes:
Could someone explain
the difference between "foo=false" and "foo is false", for a boolean
type column?
They give different results for NULL --- specifically, NULL for the
former and FALSE for the latter. Don't b
Richard Broersma Jr wrote:
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote:
CREATE VIEW view1( id, col1, type1, type2) AS
SELECT table1.id,
table1.col1,
CAST( table2.type1 AS CHARACTER( 3 )),
NULL
FROM table1
JOIN table2 ON table2.fk_table1 = table1.id
UNION ALL
SE
16 matches
Mail list logo