anchor.diff:      Typed_Parameters = lists:zip(Types, Parameters),
       Bin1 = epgsql_wire:encode_parameters(Typed_Parameters, Codec),
       Bin2 = epgsql_wire:encode_formats(Columns),
  -    send(State, ?BIND, [PortalName, 0, StatementName, 0, Bin1, Bin2]),
  -    send(State, ?FLUSH, []),
  +    send_multi(State, [
  +        {?BIND, [PortalName, 0, StatementName, 0, Bin1, Bin2]},
  +        {?FLUSH, []}
  +    ]),
       {noreply, State};
   
   command({execute, _Statement, PortalName, MaxRows}, State) ->
  -    send(State, ?EXECUTE, [PortalName, 0, <<MaxRows:?int32>>]),
  -    send(State, ?FLUSH, []),
  -    {noreply, State};
  -
  -command({execute_batch, Batch}, State) ->
  -    #state{mod = Mod, sock = Sock, codec = Codec} = State,
  -    BindExecute =
  -        lists:map(
  -          fun({Statement, Parameters}) ->
  +    send_multi(State, [
  +        {?EXECUTE, [PortalName, 0, <<MaxRows:?int32>>]},
  +        {?FLUSH, []}
  +    ]),
  +    {noreply, State};
  +
  +command({execute_batch, Batch}, #state{codec = Codec} = State) ->
  +    Commands =
  +        lists:foldr(
  +          fun({Statement, Parameters}, Acc) ->
                     #statement{name = StatementName,
                                columns = Columns,
                                types = Types} = Statement,
                     Typed_Parameters = lists:zip(Types, Parameters),
                     Bin1 = epgsql_wire:encode_parameters(Typed_Parameters, Codec),
                     Bin2 = epgsql_wire:encode_formats(Columns),
  -                  [epgsql_wire:encode(?BIND, [0, StatementName, 0,
  -                                             Bin1, Bin2]),
  -                   epgsql_wire:encode(?EXECUTE, [0, <<0:?int32>>])]
  +                  [{?BIND, [0, StatementName, 0, Bin1, Bin2]},
  +                   {?EXECUTE, [0, <<0:?int32>>]} | Acc]
             end,
  +          [{?SYNC, []}],
             Batch),
  -    Sync = epgsql_wire:encode(?SYNC, []),
  -    do_send(Mod, Sock, [BindExecute, Sync]),
  +    send_multi(State, Commands),
       {noreply, State};
   
   command({describe_statement, Name}, State) ->
  -    send(State, ?DESCRIBE, [?PREPARED_STATEMENT, Name, 0]),
  -    send(State, ?FLUSH, []),
  +    send_multi(State, [
  +        {?DESCRIBE, [?PREPARED_STATEMENT, Name, 0]},
  +        {?FLUSH, []}
  +    ]),
       {noreply, State};
   
   command({describe_portal, Name}, State) ->
  -    send(State, ?DESCRIBE, [?PORTAL, Name, 0]),
  -    send(State, ?FLUSH, []),
  +    send_multi(State, [
  +        {?DESCRIBE, [?PORTAL, Name, 0]},
  +        {?FLUSH, []}
  +    ]),
       {noreply, State};
   
   command({close, Type, Name}, State) ->
  
positive.code: 
  send(#state{mod = Mod, sock = Sock}, Type, Data) ->
      do_send(Mod, Sock, epgsql_wire:encode(Type, Data)).
  
  do_send(gen_tcp, Sock, Bin) ->
      try erlang:port_command(Sock, Bin) of
  
negative.code:         statement -> ?PREPARED_STATEMENT;
          portal    -> ?PORTAL
      end,
      send_multi(State, [
          {?CLOSE, [Type2, Name, 0]},
          {?FLUSH, []}
      ]),
      {noreply, State};
  
  command(sync, State) ->
  