3 posts by minhdang

Apollo GraphQL Fetch Policy

How you want your component to interact with the Apollo cache. Defaults to “cache-first”.

There are many options to this: “cache-first” | “cache-and-network” | “network-only” | “cache-only” | “no-cache” | “standby”

 const { loading, error, data } = useQuery(QUERY, {
    variables: queryVariables,
    fetchPolicy: 'no-cache'
  })

FASTER INSERTION WITH COPY

COPY results will be faster than INSERT due to they don’t have to do round trip, PostgreSQL doesn’t have to do planning and executing multiple INSERT statements.

COPY table_name [ ( column_name [, ...] ) ]
    FROM { 'filename' | STDIN }
    [ [ WITH ] ( option [, ...] ) ]

COPY { table_name [ ( column_name [, ...] ) ] | ( query ) }
    TO { 'filename' | STDOUT }
    [ [ WITH ] ( option [, ...] ) ]

where option can be one of:

    FORMAT format_name
    OIDS [ boolean ]
    DELIMITER 'delimiter_character'
    NULL 'null_string'
    HEADER [ boolean ]
    QUOTE 'quote_character'
    ESCAPE 'escape_character'
    FORCE_QUOTE { ( column_name [, ...] ) | * }
    FORCE_NOT_NULL ( column_name [, ...] )
    ENCODING 'encoding_name'