fattinka
asked on
Optimizing Postgresql insert
I am currently using postgresql 7.3.4 with a postfix/amavis/spamassassi n mail filter. I've had a lot of performance problems..right now, the whole thing seems to be running fine, except when it comes to INSERT queries. It takes pgsql aproximatively 25 seconds to insert ONE row!! The query itself is "INSERT INTO table (field1,field2,field3) VALUES (?,?,?), and that particular table contains 1,628,525 rows. Does anyone have a clue on how i can optimize this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Syntax is
REINDEX { DATABASE | TABLE | INDEX } name [ FORCE ]
REINDEX { DATABASE | TABLE | INDEX } name [ FORCE ]
If your database must remain live then dropping and recreating the indexes may be better option than using REINDEX command. REINDEX command creates a table lock, see documentation.
eg
su - postgres
psql prod
\q
vacuumdb prod
have you any superfluous indexes on this table ?