Search Postgresql Archives

Re: WHERE vs ORDER BY vs LIMIT why not using the correct index?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"D. Dante Lorenso" <dante@xxxxxxxxxxx> writes:
> I don't understand why the ORDER BY condition would be affecting my 
> WHERE criteria.  Shouldn't the ordering be done after the filter is 
> first applied?

No, not necessarily.  The problem you've got is that the planner
thinks there are 1473 rows not 4 that have status = 'D', and that
affects the choice of plan.  Have you ANALYZEd this table lately?

You might need to push up the statistics target to get reasonable
stats for the very infrequent status values ...

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux