Optimizing Postgresql insert

I am currently using postgresql 7.3.4 with a postfix/amavis/spamassassin 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?
fattinkaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
earth man2Connect With a Mentor Commented:
Try REINDEXing your indexes.

REINDEX index_name;

See POSTGRES_HOME/contrib/reindexdb for a utility that will reindex all your database indexes.
0
 
earth man2Commented:
Have you vacuumed your database recently?
eg

su - postgres
psql prod
\q
vacuumdb prod

have you any superfluous indexes on this table ?
0
 
earth man2Commented:
Syntax is

REINDEX { DATABASE | TABLE | INDEX } name [ FORCE ]
0
 
earth man2Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.