Thread: nuderstanding 'explain analyse'

nuderstanding 'explain analyse'

From
Alexandre Leclerc
Date:
Hello,

I build two SELECT queries, and in one I used COALESCE with a CASE,
and in the second one I used only CASE statements.

When analysing, I'm getting the exact same result, except the cost.
(For now I have so few data that the results are too fragmented.

If the plans for both queries are exactly the same, should I assume
that the cost will also be the same?

Thanks for any help.
--
Alexandre Leclerc

Re: nuderstanding 'explain analyse'

From
Josh Berkus
Date:
Alexandre,

> If the plans for both queries are exactly the same, should I assume
> that the cost will also be the same?

Nope.   A seq scan over 1,000,000,000 rows is going to cost a LOT more than a
seq scan over 1000 rows, even though it's the same plan.

When you have the data sorted out, post explain analyzes and we'll take a shot
at it.

--
Josh Berkus
Aglio Database Solutions
San Francisco