Re: Using indexes and keys

Поиск
Список
Период
Сортировка
От John Taylor
Тема Re: Using indexes and keys
Дата
Msg-id 02021110231000.01463@splash.hq.jtresponse.co.uk
обсуждение исходный текст
Ответ на Re: Using indexes and keys  ("Josh Berkus" <josh@agliodbs.com>)
Ответы Re: Using indexes and keys  ("Josh Berkus" <josh@agliodbs.com>)
Список pgsql-novice
Josh,

I've taken your advise and ordered a book, but until that arrives,
one further question, if you don't mind:

On Friday 08 February 2002 17:49, Josh Berkus wrote:

>
> > 2a) If so - If I define two or more columns as the primary key, will
> >  they
> >     be indexed seperately, or do I need to index the 2nd and 3rd
> >  columns
> >     seperately
>
> They will be indexed together.  So, if you need to do lookups on the
>  3rd column seperate from the 1st, you will need to build a seperate
>  index for that column alone.
>

If I need to lookup on a combined key, how do I do that ?
The CREATE TABLE syntax doesn't seem to allow me to combine the columns into a single key name.

Additionally, if I combine two VARCHAR columns are the following keys unique ?

...
    a VARCHAR(10),
    b VARCHAR(10),
    PRIMARY KEY (a,b),
...

a="abc", b="def"

a="ab", b="cdef"

If not, would I need to make a CHAR(10) rather than VARCHAR(10), or is there some other trick ?


Thanks
JohnT




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

Предыдущее
От: Phil Mitchell
Дата:
Сообщение: how to INSERT foreign keys?
Следующее
От: Rob
Дата:
Сообщение: Triggers