Search Postgresql Archives

Re: Problem with index not being chosen inside PL/PgSQL function...

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

 



"Weber, Geoffrey M." <Geoffrey.Weber@xxxxxxxxxxxxx> writes:
> Hmm - good question!  However, it is - both the id and
> not_displayed_id are INTEGERs.

Well, in that case it must be a statistics issue --- does the indexed
column have a badly skewed distribution?

You could investigate how many rows the planner thinks will be fetched
via

PREPARE foo(int) AS
SELECT ah.* FROM alert ah where ( (ah.replaced_by_id = '0') AND (not_displayed_id = $1 ) ) ORDER BY replaced_by_id, not_displayed_id;

EXPLAIN EXECUTE foo(42);

which will set up exactly the same planning situation as occurs in the
plpgsql function: no knowledge of the exact value being compared to.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[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