Bad query plan when you add many OR conditions

2020-01-09 Thread Marco Colli
Hello! I have a query on a large table that is very fast (0s): https://gist.github.com/collimarco/039412b4fe0dcf39955888f96eff29db#file-fast_query-txt Basically the query matches the rows that have a tag1 OR tag2 OR tag3 OR tag4 OR tag5... However if you increase the number of OR at some point P

Re: Bad query plan when you add many OR conditions

2020-01-09 Thread Justin Pryzby
On Fri, Jan 10, 2020 at 02:11:14AM +0100, Marco Colli wrote: > I have a query on a large table that is very fast (0s): > https://gist.github.com/collimarco/039412b4fe0dcf39955888f96eff29db#file-fast_query-txt ORDER BY + LIMIT is a query which sometimes has issues, you can probably find more by sea