Re: Re: Different execution plan between PostgreSQL 8.4 and 12.11

2022-10-11 Thread David Rowley
On Tue, 11 Oct 2022 at 16:13, gzh wrote: > new=# explain analyze select 2 from analyze_word_reports where (cseid = 94) > limit 1; > Limit (cost=0.00..0.43 rows=1 width=4) (actual time=2156.964..2156.966 > rows=1 loops=1) >-> Seq Scan on analyze_word_reports (cost=0.00..528550.75 rows=122

Re: Re: Re: Re: Re: Different execution plan between PostgreSQL 8.4 and 12.11

2022-10-11 Thread Pavel Stehule
út 11. 10. 2022 v 10:01 odesílatel gzh napsal: > Thank you for providing the requested information. > > > The WebSite has been used for many years, and this upgrade is only a > version upgrade of the PostgreSQL database. > My customer does not want to modify the SQL because it will increase the >

Re:Re: Re: Re: Re: Different execution plan between PostgreSQL 8.4 and 12.11

2022-10-11 Thread gzh
Thank you for providing the requested information. The WebSite has been used for many years, and this upgrade is only a version upgrade of the PostgreSQL database. My customer does not want to modify the SQL because it will increase the cost of the project(All SQL that contains a LIMIT claus

Re: Re: Re: Re: Different execution plan between PostgreSQL 8.4 and 12.11

2022-10-10 Thread Pavel Stehule
út 11. 10. 2022 v 7:08 odesílatel gzh napsal: > Hi, Pavel > > > > The LIMIT clause changes total cost. This is a very aggressive clause. > And > > > although it is absolutely useless in this case, Postgres does not have > any > > > logic for removing it. Postgres doesn't try to fix developer's m

Re:Re: Re: Re: Different execution plan between PostgreSQL 8.4 and 12.11

2022-10-10 Thread gzh
Hi, Pavel > The LIMIT clause changes total cost. This is a very aggressive clause. And > although it is absolutely useless in this case, Postgres does not have any > logic for removing it. Postgres doesn't try to fix developer's mistakes. Sorry,I didn't understand what you mean. Couldn't t

Re: Re: Re: Different execution plan between PostgreSQL 8.4 and 12.11

2022-10-10 Thread Pavel Stehule
út 11. 10. 2022 v 6:05 odesílatel gzh napsal: > > Hi, Pavel > > Thank you for your reply. > > > > the LIMIT clause is in this case totally useless and messy, and maybe can > > > negative impacts optimizer > > Yes. After removing the LIMIT clause, the performance is improved. > > The execution pla

Re: Re: Different execution plan between PostgreSQL 8.4 and 12.11

2022-10-10 Thread Pavel Stehule
út 11. 10. 2022 v 5:13 odesílatel gzh napsal: > Hi, Tom > Thank you for your reply. > > > When you're asking for help, please don't give us vague statements > > > like "doesn't seem to work". > > I understand. > > > > Did the plan (including rowcount > > > estimates) change at all? To what? How