Re: Drawbacks of using BYTEA for PK?
| От | Bruno Wolff III |
|---|---|
| Тема | Re: Drawbacks of using BYTEA for PK? |
| Дата | |
| Msg-id | 20040113155138.GA26266@wolff.to обсуждение исходный текст |
| Ответ на | Re: Drawbacks of using BYTEA for PK? ("D. Dante Lorenso" <dante@lorenso.com>) |
| Список | pgsql-general |
On Mon, Jan 12, 2004 at 20:24:10 -0600, "D. Dante Lorenso" <dante@lorenso.com> wrote: > > See what I mean? What do you propose as the best solution for this? > Not expose > the sequences to the user and use user-enumerated ids? Then a trigger > on the > table would assign ids like: > > SELECT (MAX(widget_id)+1) INTO NEW.widget_id > WHERE cust_id = NEW.cust_id; > > But I think after several hundred customer records, this trigger would start > getting slow. I don't know really, any ideas? I think it would be better to have a per customer counter. Then the GID would be customer, customer_sequence. You probably wouldn't want to use postgres sequences for this. I would expect that generating new ID numbers isn't so common that updating a counter row in a customer counter table would be a real problem.
В списке pgsql-general по дате отправления: