On Tue, Nov 02, 2010 at 10:46:42AM +0100, Matthieu Huin wrote: > Hello, > > If you expect your data to reach some kind of "critical size" at some > point ( ie updates will be more likely than inserts at that point ), you > can optimize your UPSERT code by trying to UPDATE before INSERTing. > Otherwise trying to INSERT first should decrease the average UPSERT > execution time in the long run, since you are less likely to hit the > exception and do some extra work on the table. You'd almost think of using some kind of branch prediction techniques. You could track what happened the last two times and use that to predict which would be better. There's always pathelogical cases, but it could work well for normal workloads. Have a nice day, -- Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/ > Patriotism is when love of your own people comes first; nationalism, > when hate for people other than your own comes first. > - Charles de Gaulle
Attachment:
signature.asc
Description: Digital signature