New FAQ items

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема New FAQ items
Дата
Msg-id 199909282115.RAA04812@candle.pha.pa.us
обсуждение исходный текст
Список pgsql-general
Here are two new FAQ items.  They are on the web site, along with an
expanded TODO list.

---------------------------------------------------------------------------


4.22) How do I create a column that will default to the current time?

The tempation is to do:

        create table test (x int, modtime timestamp default 'now');

but this makes the column default to the time of table creation, not the
time of row insertion.
Instead do:

        CREATE TABLE test (x int, modtime timestamp default now() );

The calling of the function now() prevents the default value from being
computed at table creation time, and delays it until insertion time. We
believe this will not be a problem in post-6.5.* releases.

4.23) Why are my subqueries using IN so slow?

Currently, we join subqueries to outer queries by sequential scanning
the result of the subquery for each row of the outer query. A workaround
is to replace IN with EXISTS. For example, change:


        SELECT *
        FROM tab
        WHERE col1 IN (SELECT col2 FROM TAB2)

to:


        SELECT *
        FROM tab
        WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 = col2)

We hope to fix this limitation in a future release.


--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

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

Предыдущее
От: Jim Cromie
Дата:
Сообщение: Referential Integrity functions for 2 different users
Следующее
От: ivan@seppuku.net
Дата:
Сообщение: Re: [GENERAL] Solaris 7 x86 error