Re: Seq scan instead of index scan querying single row from primary key on large table

2024-07-30 Thread Andy Fan
Tom Lane writes: > I'm not sure what to do about this. I think that things might work > out better if we redefined the startup cost as "estimated cost to > retrieve the first tuple", rather than its current very-squishy > definition as "cost to initialize the scan". Actually I wanted to raise t

Re: Seq scan instead of index scan querying single row from primary key on large table

2024-07-18 Thread Tom Lane
James Coleman writes: > On Thu, Jul 18, 2024 at 2:38 PM Tom Lane wrote: >> Are you really sure nothing changed about what the ORM is emitting? > Yes, aside from the fact that application code didn't change, we > reproduced the problem by restoring a physical snapshot of the > database and were a

Re: Seq scan instead of index scan querying single row from primary key on large table

2024-07-18 Thread James Coleman
On Thu, Jul 18, 2024 at 2:38 PM Tom Lane wrote: > > James Coleman writes: > > The plan generated by the planner changed suddenly one morning this > > week, and in a very surprising way: the innermost scan (of "objects") > > started choosing a seq scan, despite the cost from that node being > > ve

Re: Seq scan instead of index scan querying single row from primary key on large table

2024-07-18 Thread Tom Lane
James Coleman writes: > The plan generated by the planner changed suddenly one morning this > week, and in a very surprising way: the innermost scan (of "objects") > started choosing a seq scan, despite the cost from that node being > very high and an index scan being possible That looks weird to