Re: Different execution plan between PostgreSQL 8.2 and 12.5

2022-08-18 Thread Adrian Klaver
On 8/18/22 02:50, gzh wrote: Dear Tom, Thanks for your reply. Please refer to the information below: I run following sql in PostgreSQL 8.2 and PostgreSQL 12.5, it returns different execution plan. There are ~13 years of improvements to the planner and the database as a whole, I would mo

Re: Re: Different execution plan between PostgreSQL 8.2 and 12.5

2022-08-18 Thread Torsten Krah
But you should do that according to the documentation: ... After restoring a backup, it is wise to run ANALYZE on each database so the query optimizer has useful statistics. ...

Re: Different execution plan between PostgreSQL 8.2 and 12.5

2022-08-17 Thread Adrian Klaver
On 8/17/22 20:01, gzh wrote: Hi, I have had a Perl Website working for 7 years and have had no problems until a few weeks ago I replaced my database server with a newer one. Did you run ANALYZE on the 12.5 server after restoring the data to it? gzh -- Adrian Klaver adrian.kla...@akl

Re: Different execution plan between PostgreSQL 8.2 and 12.5

2022-08-17 Thread David Rowley
On Thu, 18 Aug 2022 at 15:32, Tom Lane wrote: > The 12.5 plan looks like it thinks that the join condition is not > hashable --- and probably not mergeable as well, else it would have > done a mergejoin. This is odd if we assume that the lower() > outputs are just text. But you haven't said anyt

Re: Different execution plan between PostgreSQL 8.2 and 12.5

2022-08-17 Thread Tom Lane
gzh writes: > I run following sql in PostgreSQL 8.2 and PostgreSQL 12.5, it returns > different execution plan. 8.2 is ... well, not stone age maybe, but pretty durn ancient. You really ought to update a bit more often than that. (And maybe pay more attention to staying up to date with minor re