Slow loads when indexes added.

Поиск
Список
Период
Сортировка
От Stef
Тема Slow loads when indexes added.
Дата
Msg-id 20050315172345.7e444432@svb.ucs.co.za
обсуждение исходный текст
Список pgsql-performance
Hi all,

I suspect this problem/bug has been dealt with already, but I couldn't
find anything in the mail archives.

I'm using postgres 7.3, and I managed to recreate the problem using the attached
files.

The database structure is in slow_structure.sql

After creating the database, using this script, I ran run_before_load__fast.sql

Then I created a load file using create_loadfile.sh (It creates a file called load.sql)

I timed the loading of this file, and it loaded in 1 min 11.567 sec

Then I recreated the database from slow_structure.sql, ran run_before_load__slow.sql,
and then loaded the same load.sql and it took 3 min 51.293 sec which is about 6 times slower.

I tried the same thing on postgres 8.0.0 to see if it does the same thing, but there it
was consistently slow : 3 min 31.367 sec

The only way I got the load.sql to load fast on postgres 8.0.0,  was by not creating
any of the foreign key constraints that point to the "main" table, and then enabling them
afterwards. This gave me the fastest time overall  : 1 min 4.911 sec

My problem is that on the postgres 7.3.4 database I'm working with, a load process that
used to take 40 minutes, now takes 4 hours, because of 3 rows data being loaded into
a table (similar in setup to the "main" table in the example) before the indexes were created.
(This happens automatically  when you dump and re-import the database (7.3.4))

Is there a way to get it to load fast again on the 7.3 database without dropping the foreign
key constraints (After running run_before_load_slow.sql) ?

And, if someone knows off-hand, what's happening here?

TIA
Kind Regards
Stefan

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Changing the random_page_cost default (was: cpu_tuple_cost)
Следующее
От: PFC
Дата:
Сообщение: Re: Avoiding tuple construction/deconstruction during joining