A Dimarts 27 Desembre 2005 18:13, Michael Fuhr va escriure: > On Tue, Dec 27, 2005 at 05:09:28PM +0100, Albert Cervera Areny wrote: > > However, now we have a query that is much slower with 8.1 compared to > > 7.4. The query lasts 7minutes (all the times we try) with 8.1, keeping > > CPU usage at 93~97% while it lasts 25 seconds in 7.4 the first time going > > down to 4 seconds the following tries. > > We're not experts at all but we can't see anything strange with the > > differences of EXPLAIN in the queries. Below I paste the query and the > > EXPLAIN output. > > Could you post the EXPLAIN ANALYZE output of the query on both > systems? That'll show how accurate the planner's estimates are. > > Have you run ANALYZE (or VACUUM ANALYZE) on the tables in both > versions? The row count estimates in the 8.1.1 query differ from > those in the 7.4.7 query. Are the two versions using the same data > set? > > Are your configuration settings the same in both versions? You > mentioned increasing work_mem, but what about others like > effective_cache_size, random_page_cost, and shared_buffers? Hey, thank you for your fast response, I found what the problem was. I thought the settings were the same but work_mem was still higher in 7.4, 30Mb, so I increased 8.1 to 30Mb and it worked faster, down to 17 seconds the first time, 2.5 seconds for the others. Are there any "rules of thumb" to let a begginer give reasonable values to these parameters? Not only work_mem, but also random_page_cost, and so on. Are there any tests one can run to determine "good" values? Thanks a lot! -- Albert Cervera Areny Dept. Informàtica Sedifa, S.L. Av. Can Bordoll, 149 08202 - Sabadell (Barcelona) Tel. 93 715 51 11 Fax. 93 715 51 12 ==================================================================== ........................ AVISO LEGAL ............................ La presente comunicación y sus anexos tiene como destinatario la persona a la que va dirigida, por lo que si usted lo recibe por error debe notificarlo al remitente y eliminarlo de su sistema, no pudiendo utilizarlo, total o parcialmente, para ningún fin. Su contenido puede tener información confidencial o protegida legalmente y únicamente expresa la opinión del remitente. El uso del correo electrónico vía Internet no permite asegurar ni la confidencialidad de los mensajes ni su correcta recepción. En el caso de que el destinatario no consintiera la utilización del correo electrónico, deberá ponerlo en nuestro conocimiento inmediatamente. ==================================================================== ........................... DISCLAIMER ............................. This message and its attachments are intended exclusively for the named addressee. If you receive this message in error, please immediately delete it from your system and notify the sender. You may not use this message or any part of it for any purpose. The message may contain information that is confidential or protected by law, and any opinions expressed are those of the individual sender. Internet e-mail guarantees neither the confidentiality nor the proper receipt of the message sent. If the addressee of this message does not consent to the use of internet e-mail, please inform us inmmediately. ====================================================================