Re: Query takes way longer with LIMIT, and EXPLAIN takes way longer than actual query

2020-08-14 Thread Justin Pryzby
On Fri, Aug 14, 2020 at 03:40:40PM -0700, Ken Tanzer wrote: > On Fri, Aug 14, 2020 at 3:04 PM Justin Pryzby wrote: > > Due to the over-estimated rowcount, the planner believes that (more) rows > > will be output (sooner) than they actually are: > > > >-> Nested Loop Semi Join (cost=47.11..31

Re: Query takes way longer with LIMIT, and EXPLAIN takes way longer than actual query

2020-08-14 Thread Jeff Janes
On Fri, Aug 14, 2020 at 5:35 PM Ken Tanzer wrote: > Hi. I've got a query that runs fine (~50ms). When I add a "LIMIT 25" to > it though, it takes way longer. The query itself then takes about 4.5 > seconds. And when I do an explain, it takes 90+ seconds for the same query! > > Explains and de

Re: Query takes way longer with LIMIT, and EXPLAIN takes way longer than actual query

2020-08-14 Thread Ken Tanzer
On Fri, Aug 14, 2020 at 3:04 PM Justin Pryzby wrote: > Due to the over-estimated rowcount, the planner believes that (more) rows > will > be output (sooner) than they actually are: > >-> Nested Loop Semi Join (cost=47.11..31367302.81 ROWS=611586 > width=336) (actual time=47.098..97236.123 R

Re: Query takes way longer with LIMIT, and EXPLAIN takes way longer than actual query

2020-08-14 Thread Justin Pryzby
On Fri, Aug 14, 2020 at 02:34:52PM -0700, Ken Tanzer wrote: > Hi. I've got a query that runs fine (~50ms). When I add a "LIMIT 25" to > it though, it takes way longer. The query itself then takes about 4.5 > seconds. And when I do an explain, it takes 90+ seconds for the same query! Due to the

Query takes way longer with LIMIT, and EXPLAIN takes way longer than actual query

2020-08-14 Thread Ken Tanzer
Hi. I've got a query that runs fine (~50ms). When I add a "LIMIT 25" to it though, it takes way longer. The query itself then takes about 4.5 seconds. And when I do an explain, it takes 90+ seconds for the same query! Explains and detailed table/view info below. tbl_log has 1.2M records, tbl_