"Gnanakumar" <gnanam@zoniac.com> wrote:
>> If that doesn't do it I might try adding zero to numbers and
>> concatenating empty strings to try to prevent late use of the
>> OID. (Essentially as a form of optimization barrier.)
>
> I couldn't understand this approach clearly. Can you help explain
> me with some example?
For a string it would be changing something like this:
schemaname,
to something like this:
schemaname || '' AS schemaname,
for a number it might be changing:
pg_total_relation_size(schemaname||'.'||tablename)
to:
pg_total_relation_size(schemaname||'.'||tablename) + 0
Again, I would try without these first. If the problem persists I
would sprinkle these throughout the query. If the problem goes
away, I would probably selectively remove them until the problem
returned, so I would know where it matters.
-Kevin