Re: Is it necessary to have index for child table in following case?

Поиск
Список
Период
Сортировка
От Yan Cheng Cheok
Тема Re: Is it necessary to have index for child table in following case?
Дата
Msg-id 953543.49640.qm@web65713.mail.ac4.yahoo.com
обсуждение исходный текст
Ответ на Re: Is it necessary to have index for child table in following case?  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
Ответы Re: Is it necessary to have index for child table in following case?  (Joe Conway <mail@joeconway.com>)
Список pgsql-general
>
> Are you using INSERT or COPY to insert your data? COPY
> tends to be a lot faster than separate INSERTs, especially
> if you don't wrap the INSERTs in a transaction block and
> COMMIT them in batches.
>

But I do not use File or Stdio. The data is coming in row by row real-time. I need to insert the data programmatic
real-timeinto the database. That's why I use INSERT. But maybe I miss out something on the usage of COPY, please advice
:)

> As an aside, I hope you do realise that your primary key
> isn't guaranteed to be unique across your child tables? The
> reason is the same one that you already quoted for indexes
> spanning multiple tables - a primary key is implemented
> using a unique index after all.
>
> If that matters, what you can do is make your primary key a
> foreign key to a new table with just the primary key column
> in it. Make sure you always insert a record in the primary
> key table along with the one referencing it, so that you
> will get a unique violation when you try to insert a record
> for which the primary key already exists. This will of
> course slow things down some, but if it's necessary that's
> the price to pay.
>

Oh. I didn't notice that. Thanks for pointing out. Luckily, thanks God. It doesn't matter much at this moment :)





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

Предыдущее
От: "Wang, Mary Y"
Дата:
Сообщение: Need to Remove Constraint, but Don't Know How - Previous attempts failed
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Need to Remove Constraint, but Don't Know How - Previous attempts failed