How to tune insert and update statements?

Hi all,

I am using mysql 4 on solaris 8.
Can anyone plese give me suggestions how to improve the performance of insert and update statements without making any changes in code.

Regards
Susheel

To speed up insert’s you should have as few indexes as possible.
But to speed up update’s and selects you need indexes.
So you have a Catch-22 on your hand.
The problem is that it’s not so easy to optimize a database so that you can give any general advice that will always work out of the box. It all depends on your data and what query pattern your application has.

But here are two tips for different storage engines:
If you are using InnoDB tables you can turn off flushing of the transactin log by setting:
innodb_flush_log_at_trx_commit=2
in my.cnf.

And if you are using MyISAM then you can get some advantages by having a table optimized. But that only works if you can optimize the table after deletes. Which isn’t always possible since the table has to be locked during this optimization.