How to make subtraction without repeating the subqueries? I need to efficiently obtain: 


  players who play more than one world cup and who have never been champion.


primary-key | foreign-key | pk-and-fk

PLAYER&lt;player_id, player_name, country_player, ...>

WORLD&lt;year, winner, ...>

PLAYED_WORLD&lt;player, world_year, ...>

In the first operand of the subtraction I obtain the players with more than 1 world cup no matter if they are champions.
In the second operand, I get the players with more than 1 world cup that have already won.

The following query works for me but my idea is to optimize it to be more efficient, since the difference between both operands is nothing more than: WHERE country_player = winner

SELECT *
FROM        (SELECT player_name
        FROM    (SELECT player_id, world_year, player_name, country_player
                FROM    (SELECT player, world_year
                        FROM    (SELECT player
                                FROM played_world
                                GROUP BY player
                                HAVING count(player) &gt; 1) AS playerMoreThan1
                        NATURAL JOIN played_world) AS worldPlayers
                JOIN player ON player= player_id) AS infoWorldPlayers
        JOIN world ON world_year = year) noChampions
EXCEPT      (SELECT player_name
        FROM    (SELECT player_id, world_year, player_name, country_player
                FROM    (SELECT player, world_year
                        FROM    (SELECT player
                                FROM played_world
                                GROUP BY player
                                HAVING count(player) &gt; 1) AS playerMoreThan1
                        NATURAL JOIN played_world) AS worldPlayers
                JOIN player ON player = player_id) AS infoWorldPlayers
        JOIN world ON world_year = year
        WHERE country_player = winner)


Is there a strategy to reuse the queries of the first operand?

If you need the design and the initial load of the db the attached in the publication.
You can use CTEs when you have repeating subqueries. Although it's not necessarily better for performance, in Postgres CTEs are an optimization fence, in other words they are evaluated once (or not at all).

Your query can probably be written more simply though:

SELECT player
FROM played_world AS pw
WHERE NOT EXISTS
      ( SELECT 1
        FROM world AS w
             JOIN player AS p
             ON w.winner = p.country_player
        WHERE w.year = pw.world_year
          AND p.player_id = pw.player
      ) 
GROUP BY player
HAVING count(*) &gt; 1 ;


or with EXCEPT:

SELECT player
FROM played_world
GROUP BY player
HAVING count(*) &gt; 1 

EXCEPT

SELECT p.player_id
FROM world AS w
     JOIN player AS p
     ON w.winner = p.country_player ;