Re: MySQL to Postgres question

Поиск
Список
Период
Сортировка
От Paul Boddie
Тема Re: MySQL to Postgres question
Дата
Msg-id 80a140b8-6b7f-4f64-be32-0596771a5287@s13g2000prd.googlegroups.com
обсуждение исходный текст
Ответ на MySQL to Postgres question  ("Edward Blake" <comedian.watchman@gmail.com>)
Список pgsql-general
On 21 Mar, 17:15, comedian.watch...@gmail.com ("Edward Blake") wrote:
>
> When I try and rewrite it as a Postgres statement (below), it fails at line
> 9.
>  0 SET CONSTRAINTS ALL DEFERRED;
>  1 CREATE TABLE products (
>  2      product_id serial[11] not null,
>  3      product_name varchar[255] not null,
>  4      product_descrition varchar[255] not null,
>  5      class_id integer[11] not null,
>  6      subclass_id integer[11] not null,
>  7      department_id integer[11] not null
>  8      PRIMARY KEY (product_id),
>  9      KEY class_id (class_id),

Isn't KEY a MySQL shorthand for creating an index within the table
declaration. Why not create the index afterwards using CREATE INDEX
instead?

> 10      KEY subclass_id (subclass_id),
> 11      KEY department_id (department_id)
> 12 );
>
> Any ideas?

Yes, just decouple the index declarations from the table declaration.
There are benefits to doing this, too, such as being able to populate
tables more rapidly before the indexes are added - a technique which
appears to be useful for certain kinds of applications.

Paul

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

Предыдущее
От: "Andrej Ricnik-Bay"
Дата:
Сообщение: Re: [postgis-users] how many min. floating-points?
Следующее
От: "Edward Blake"
Дата:
Сообщение: MySQL to Postgres question