[Debian] PostgreSQL beim Einlesen grosser Datenmengen beschleunigen WAS: Web-Design unter Linux?
Hallo nochmal,
Andreas Tille schrieb:
> Ich will nicht sagen, daß an irgendwelchen Benchmarks was gedreht wurde
> sondern nur, daß ich nicht wenige % Geschwindigkeitsvorteil für die eine
> oder die andere Datenbank als Kriterium ansehen würde, wenn es wichtigere
> Dinge gibt. Und das wichtigste an einer Datenbank ist, daß ich die Daten
> absolut zuverlässig rein und auch wieder raus kriege.
Wenn's aber mal schnell gehen soll (was bei einem einmaligen Einlesen von
großen Datenmengen ja durchaus angenehm ist), hilft neben PGFSYNC=no der
unter http://localhost/doc/postgresql-doc/html/postgres/c4933.htm zu
findende Tip:
Disable Auto-commit
Turn off auto-commit and just do one commit at the end. Otherwise Postgres
is doing a lot of work for each record added. In general when you are
doing bulk inserts, you want to turn off some of the database features to
gain speed.
oder c49334943.htm
Use COPY FROM
Use COPY FROM STDIN to load all the records in one command, instead of a
series of INSERT commands. This reduces parsing, planning, etc overhead a
great deal. If you do this then it's not necessary to fool around with
autocommit.
oder c49334947.htm
Remove Indices
If you are loading a freshly created table, the fastest way is to create
the table, bulk-load with COPY, then create any indexes needed for the
table. Creating an index on pre-existing data is quicker than updating it
incrementally as each record is loaded.
If you are augmenting an existing table, you can DROP INDEX, load the
table, then recreate the index. Of course, the database performance for
other users may be adversely affected during the time that the index is
missing.
> Selbst bei der Evolution ist das so. Ich könnte Dir zig Beispiele nennen,
> bei denen ein dritter Arm enorme Vorteile brächte und doch haben wir alle
> nur zwei. ;-)
Im Durchschnitt dürfte es auch effizienter sein ;-)
Gruß,
Knut
--
-----------------------------------------------------------
Um sich aus der Liste auszutragen schicken Sie bitte eine
E-Mail an debian-user-de-request@lehmanns.de die im Subject
"unsubscribe <deine_email_adresse>" enthaelt.
Bei Problemen bitte eine Mail an: Jan.Otto@Lehmanns.de
-----------------------------------------------------------
676 eingetragene Mitglieder in dieser Liste.
Reply to: