18.2 Creating Property Graphs Using Options
Learn about the different options for graph optimization and for handling edges with missing vertices.
Using the OPTIONS clause in the CREATE PROPERTY GRAPH statement,
            you can specify  any of the options explained in the following sections:
               
Using Graph Optimization Options
You can load a graph for querying and analytics or for performing update
                operations. Depending on your requirement, you can optimize the read or update
                performance using the OPTIONS clause in the CREATE PROPERTY
                    GRAPH statement.
                  
The following table describes the valid options that are supported in the
                    OPTIONS clause:
                  
Table 18-1 Graph Optimization Options
| OPTIONS | Description | 
|---|---|
| OPTIMIZED_FOR_READ | This can be used for read-intensive scenarios. | 
| OPTIMIZED_FOR_UPDATES | This is the default option and can be used for fast updates. | 
| SYNCHRONIZABLE | This assures that the graph can be synchronized via Flashback Technology. However, exceptions are thrown if one of the edge keys is either composite or non-numeric. In these cases, the graph can normally still be loaded, but PGX generates a new (numeric and non-composite) edge key. Such edges can therefore not be synchronized with the database. | 
For example, the following graph is set using
                    OPTIMIZED_FOR_UPDATES and SYNCHRONIZABLE
                options:
                  
CREATE PROPERTY GRAPH hr 
VERTEX TABLES ( 
employees LABEL employee, departments LABEL department 
) 
EDGE TABLES ( 
departments AS managed_by 
SOURCE KEY ( department_id ) REFERENCES departments (department_id)
DESTINATION employees 
NO PROPERTIES 
) OPTIONS (OPTIMIZED_FOR_UPDATES, SYNCHRONIZABLE)Note:
- SYNCHRONIZABLEoption can be used in combination with- OPTIMIZED_FOR_UPDATESand- OPTIMIZED_FOR_READ. But,- OPTIMIZED_FOR_UPDATESand- OPTIMIZED_FOR_READcannot be used together and in such a case an exception will be thrown.
- If you are creating a synchronizable graph, then ensure that the vertex and edge keys are numeric and non-composite.
Using Options to Handle Edges with Missing Vertices
If either the source or destination vertex or both are missing for an edge, then you
                can configure one of the following values in the OPTIONS clause in the
                    CREATE PROPERTY GRAPH statement:
                  
- IGNORE EDGE ON MISSING VERTEX: Specifies that the edge for a missing vertex must be ignored.
- IGNORE EDGE AND LOG ON MISSING VERTEX: Specifies that the edge for a missing vertex must be ignored and all ignored edges must be logged.
- IGNORE EDGE AND LOG ONCE ON MISSING VERTEX: Specifies that the edge for a missing vertex must be ignored and only the first ignored edge must be logged.
- ERROR ON MISSING VERTEX(default): Specifies that an error must be thrown for edges with missing vertices.
For example, the following graph is set using ERROR ON MISSING
                    VERTEX option:
                  
CREATE PROPERTY GRAPH region_graph 
VERTEX TABLES ( 
regions KEY (region_id), 
countries KEY (country_id)
) 
EDGE TABLES ( 
countries AS countries_regions 
SOURCE KEY ( country_id ) REFERENCES countries(country_id) 
DESTINATION KEY (region_id) REFERENCES regions(region_id) 
NO PROPERTIES 
) OPTIONS ( ERROR ON MISSING VERTEX)On execution, the following error response is shown:
unknown vertex ID received in destination 4 of edge 5When using IGNORE EDGE AND LOG ON MISSING VERTEX or
                    IGNORE EDGE AND LOG ONCE ON MISSING VERTEX option, you must
                update the default Logback configuration file in
                    /etc/oracle/graph/logback.xml and the graph server (PGX) logger
                configuration file in /etc/oracle/graph/logback-server.xml to log
                the DEBUG logs. Only then you can view the ignored edges in
                    /var/opt/log/pgx-server.log file.
                  
Parent topic: Executing PGQL Queries Against the Graph Server (PGX)