"john cartmell" <john.cartmell@mediaburst.co.uk> writes:
> Without the LIMIT clause the query takes approximately 3-5 seconds to
> return.
> If total number of rows returned without the LIMIT clause is greater
> than 20 records, then the above query also takes th same amount of time.
> But if the the total number of rows is 20 or less then the time taken
> for the above query to return goes up to 20-30 seconds.
What does EXPLAIN (or better EXPLAIN ANALYZE) show for these various
cases? Evidently the planner is shifting to a different plan because
of the small LIMIT, but with no details it's hard to say anything
useful.
regards, tom lane