Re: empty a database

Поиск
Список
Период
Сортировка
От Brad Nicholson
Тема Re: empty a database
Дата
Msg-id 42124788.8080500@ca.afilias.info
обсуждение исходный текст
Ответ на Re: empty a database  (Naomi Walker <nwalke@eldocomp.com>)
Список pgsql-admin
If there are any foreign key constraints, you'll have to truncate the
tables in the appropriate order.  You would also have to reset the
sequence values as well.

Naomi Walker wrote:

>How about just truncating all the tables?
>
>
>Dick Davies wrote:
>
>
>>* Tom Lane <tgl@sss.pgh.pa.us> [0232 16:32]:
>>
>>
>>
>>>Dick Davies <rasputnik@hellooperator.net> writes:
>>>
>>>
>>>
>>>>Is there a neat way to clean out a database via SQL commands?
>>>>i.e. get rid of tables, sequences, integers, etc.
>>>>
>>>>
>>>>At present I'm using dropdb/createdb, but thats' far from ideal
>>>>and I think it's causing postgres to do more mork than it needs to...
>>>>
>>>>
>>>Well, if you put everything into one or a few schemas then dropping
>>>and recreating those schemas would do it.  I suspect though that this
>>>is *not* faster than dropdb/createdb.
>>>
>>>
>>Thanks Tom.
>>
>>It's not just the speed, it's the constant deletes and creations in
>>~pgsql/data - as I said the other day, this is recreating a test db from the
>>production one as part of unit tests, so this happens dozens of times a day...
>>
>>
>>
>>
>
>
>
>


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

Предыдущее
От: Naomi Walker
Дата:
Сообщение: Re: empty a database
Следующее
От: "Joel Fradkin"
Дата:
Сообщение: who is best for support?