GLOBAL COLUMN INDEXING IN A GRAPH DATABASE
Patent Information
- Application Number
- DE602017087191
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2016-11-23
- Filing Date
- 2017-11-22
- Publication Date
- 2025-01-01
- Estimated Expiration
- 2037-11-22
AI Technical Summary
Traditional data storage and analysis systems, such as schema-based relational databases and key-value stores, are inadequate for managing rich, highly connected data due to their inflexibility and inefficiency in handling dynamic relationships and complex queries, especially as data scales to billion-edge structures.
A graph database service that employs global column indexing with automatically maintained per-column indices and real-time statistics generation, enabling efficient querying and analysis of dynamic data by partitioning indices by column name and optimizing query processing based on value distributions.
This approach allows for scalable and efficient analysis of complex relationships in large datasets, supporting sophisticated queries and dynamic data structures, while reducing storage costs and improving query performance.
Description
BACKGROUND
[0001] As an increasing amount of data is generated, the need for storage and analysis of such data is similarly growing. In varied domains such as social media, mobile and messaging apps, web portals, and the Internet of Things (IoT), data may be both rich and highly connected. New relationships between data elements may be created at a high rate, and effective analysis of such data may often include analysis of the relationships. For example, modeling a social network may include modeling relationships between people. The relationships may change over time, and information relating to the people themselves may be added or modified over time as well. Applications that seek to analyze such information may require prompt answers to complex questions regarding networks of relationships, such as purchases or preferences relating to friends of a particular person. "A survey of RDF storage approaches" by D.C. Faye et al. discloses an overview of the features of techniques for storing RDF data.SUMMARY OF INVENTION
[0002] The subject matter for which protection is sought is defined by the independent claims. Further preferred embodiments are defined in the dependent claims.BRIEF DESCRIPTION OF THE DRAWINGS
[0003] FIG. 1 illustrates an example system environment for global column indexing in a graph database. FIG. 2A through FIG. 2C illustrate examples of a graph database usable with the example system environment, including the creation of per-column indices for globally scoped column names. FIG. 3 illustrates an example of a graph database usable with the example system environment, including a relational view of data elements in the graph database. FIG. 4 illustrates an example of a graph database usable with the example system environment, including an entity view of data elements in the graph database. FIG. 5 illustrates the generation of statistics associated with per-column indices for globally scoped column names. FIG. 6 is a flowchart illustrating a method for global column indexing in a graph database. FIG. 7 illustrates an example computing device. DETAILED DESCRIPTION OF EMBODIMENTS
[0004] Various embodiments of methods, systems, and computer-readable media for global column indexing in a graph database are described. A graph database service stores elements of data in a graph database. Elements of data in the graph database represent triples or rows A triple includes a subject identifier, a column name, and a value. In one embodiment, the triples in a graph database may be used to represent nodes and edges (relationships) in a graph of connected items. Columns are strongly typed such that values in a particular column may share the same data type. Column names are globally scoped in the graph database, such that the same column name may not be represented more than once in the graph database and may not be limited to a particular sub-table of the graph database. The graph database service uses a partitioned indexing scheme to enable querying of the graph database. Indices are created and maintained for global columns in the primary table in the graph database. A per-column index may be a table or other columnar data structure that includes multiple rows, and each row includes the values associated with the column corresponding to the index. The indices are partitioned by column name. The generation and maintenance of indices is performed by the graph database service automatically, e.g., without being directly prompted by user input directing the indexing tasks. The per-column indices are used to perform queries of the graph database. To perform a query, a query planner refers to the indices corresponding to columns associated with the query. Statistics are generated and maintained for the indices in order to optimize queries. The statistics for an index may represent distributions of values within the corresponding column. To optimize a query, the order of indices to be used may be determined based (at least in part) on the statistics for the per-column indices. Statistics may be maintained automatically and in real time or near-real time to enable optimized query processing using up-to-date information.
[0005] FIG. 1 illustrates an example system environment for global column indexing in a graph database. A graph database service 100 stores elements of data in a graph database 140. The graph database may also be referred to as a graph data store or a triple store. A graph represented by the graph database service is a data structure that is suitable for representing relationships, connections, and dependencies within data. Typical examples of domains in which graphs can model data may include social networks or communication networks, biological networks, time series applications, and metadata management. A graph may include nodes (vertices) and edges (relationships) as well as properties associated with those vertices and edges. In one embodiment, a node may represent a concept or an object. An edge may represent a relationship between vertices. A vertex may have various properties such as a name. An edge may have various properties such as a type of relationship. For example, in a graph within a social network, User1, User2, and User3 may be entities, and a "friendOf" relationship between them may define the "edges" of this small graph. In one embodiment, the User1, User2, and User3 entities may have properties like "name" and "age," and the relationship properties may include "start_date," "source," and so on. Large volumes of such connected data may be generated from modern applications, mobile and messaging apps, and IoT devices. Such data tends to be dynamic, such that the relationships, entities, and their properties may be constantly changing.
[0006] Schema-based relational data stores may not be able to change rapidly enough; schema-less stores like key-value stores may be unable to work with sophisticated query languages. Traditional key-value data stores and relational data stores may often be unwieldy for managing data that is rich and highly connected. For example, key-value stores may support accessing discrete objects that do not necessarily represent rich data or relationships. As another example, relational data stores may be too inflexible to adequately represent the fluid relationships in highly connected data. When relational databases are used to store such data, developers may be required to store the data in tables with rigid structures and write complex SQL queries using multiple joins. Such complex queries may prove difficult to maintain and may not scale adequately when run on large datasets. As the data scale increases, some graphs may become billion-edge structures that challenge prior hardware and software solutions. In one embodiment, the graph database service may query such data efficiently using per-column (property-scoped) indices 160A-160N. Although indices 160A-160N are illustrated for purposes of example, any suitable number and configuration of indices may be used in the graph database.
[0007] The elements of data in the graph database represent triples or rows in a columnar format. Triples such as triples 151A through 151Z are stored in a triple table 150; the triple table may represent a primary table in the graph database. Although triples 151A-151Z are illustrated for purposes of example, any suitable number and configuration of triples may be used in the graph database. For example, a triple includes an identifier, a column name, and a value. Triples may include different elements in addition to an identifier, column, name, and value. The identifier may also be referred to as a subject identifier. In one embodiment, the identifier may indicate the particular row (e.g., in a relational view of the data) or record that holds the combination of the column name and the value in the triple. The same subject identifier may be reused for multiple triples, e.g., if the corresponding row or record includes values in multiple categories. The column name may indicate a distinct and separate category of data, and the value may represent one of the allowable values within the category. In one embodiment, the triples in a graph database may be used to represent nodes and edges (relationships) in a graph of connected items. The graph database may store one graph or multiple graphs. The triples are also stored with graph identifiers that indicate particular graphs or sub-graphs to which the triples belong.
[0008] Columns are strongly typed such that values in a particular column share the same data type, and an enforcement mechanism may ensure that values in the particular column are limited to being expressed in the data type associated with the column. Data types may differ from column to column. All the rows and columns in the graph database may effectively belong to the same primary table, e.g., the triple table. Column names are globally scoped in the graph database, such that the same column name may not be represented more than once in the graph database and may not be limited to a particular sub-table of the graph database. By way of contrast, column names in a conventional relational database are typically locally scoped to one of many tables.
[0009] The graph database service uses a partitioned indexing scheme to enable querying of the graph database. An index creation component 110 may create and maintain indices for every global column in the primary table in the graph database. The index creation component 110 may create and maintain indices for many but not necessarily all global columns in the primary table in the graph database, e.g., for columns that are intended to be queryable or searchable. A per-column index may be a table or other columnar data structure that includes multiple rows, and each row may include the values associated with the column corresponding to the index. A per-column index may also be referred to as a property-scoped index. Each row in a per-column index also includes a pointer to the corresponding row in the primary table in the graph database. The indices 160A-160N may be stored as separate data structures from each other and from the triple table 150, e.g., in storage managed by or otherwise accessible to the graph database service. In one embodiment, the indices may effectively be partitioned by column name. By way of contrast, such per-column indexing in a conventional relational database would often be prohibitively expensive due to the vastly greater number of locally scoped columns that may be managed in a relational database management system. The generation and maintenance of indices is performed by the graph database service automatically, e.g., without being directly prompted by user input directing the indexing tasks. By way of contrast, the generation and maintenance of indices for a conventional relational database is typically a manual task that requires user input to customize the indices.
[0010] The per-column indices are used to perform queries of the graph database. A client 180 may supply a query 181 and receive query results 182 from the graph database service. To perform a query, a query planner 130 may refer to the indices corresponding to columns associated with the query. A statistics generation component 120 generates and maintains statistics for the indices in order to optimize queries. The statistics generation component 120 generates and maintains sets of statistics corresponding to individual indices, such as statistics 121A-121N corresponding to the indices 160A-160N. The statistics may be stored using any suitable storage technologies, e.g., in storage managed by or otherwise accessible to the graph database service. The statistics for an index may represent distributions of values within the corresponding column. For example, the statistics may indicate how many times a particular value occurs within the column, how many triples having numeric values within a particular numeric range occur within the column, how many triples having string-typed values beginning with a particular character occur within the column, and so on.
[0011] To optimize a query, the order of indices to be used may be determined based (at least in part) on the statistics for the per-column indices. The query planner uses the most constraining index first, then the next most constraining index, and so on. The statistics may be maintained in real time or near-real time to enable optimized query processing using up-to-date information. The generation and maintenance of statistics for an index is performed by the graph database service automatically, e.g., without being directly prompted by user input directing the statistics tasks. The client 180 may supply updates 183 to triples in the graph database. An index and the statistics for the index are generated or updated by the graph database service in response to the updating of one or more triples for the corresponding column in the graph database (e.g., the addition of one or more triples, the deletion of one or more triples, or the modification of one or more triples). The graph database service provides a query hint mechanism to optimize the performance of individual queries within specific applications.
[0012] Queries of the graph database include semantic queries. A semantic query may permit the retrieval of both explicitly and implicitly derived information from the graph database based on syntactic, semantic, and structural information embodied in the database. A semantic query may return a specific or precise result such as a single piece of information. A semantic query may return an answer to a "fuzzier" or less specific question through pattern matching and machine logic. By operating on the triples in the graph database, a semantic query may process the actual relationships between information and determine an answer from the network of connections in the graph database. A semantic query may operate on structured data and utilize features such as operators (e.g., >, <, and =), pattern matching, and so on. In one embodiment, semantic queries of the graph database are formatted in the syntax of a semantic query language such as SPARQL. A semantic query may be written without knowledge of a database schema in the graph database. A query of the graph database may be expressed in a graph traversal language or graph query language such as Neo4j or Gremlin.
[0013] The graph database is designed to effectively capture and analyze rich, dynamic data structures having complex relationships. For example, a simple social query such as "find all the friends of User1's friends" may be expressed as a one-line traversal in a graph database in a graph traversal language such as Gremlin: g.V().has('name','User1').out('friend').out('friend').values('name'). However, using an SQL query to retrieve the same information from a relational database may be much more complex, such as the following query: SELECT p1.Person AS PERSON, p2.Person AS FRIEND_OF_FRIEND FROM PersonFriend pf1 JOIN Person p1 ON pf1.PersonID = p1.ID JOIN PersonFriend pf2 ON pf2.PersonID = pf1.FriendID JOIN Person p2 ON pf2.FriendID = p2.ID WHERE p1.Person = 'User1' AND pf2.FriendID <> p1.ID
[0014] The graph database service may support a simple text search on property values. In one embodiment, in the property graph model, the text search may search over node and edge properties. In the resource description framework (RDF) model, the text search may search over literal values. In one embodiment, the graph database service may employ logic to efficiently compress and store the data so that the storage costs are lowered.
[0015] The graph database service may be used by clients in varying domains such as social networks, recommendation engines, data management, network and IT management, fraud detection, medical applications, Online Transaction Processing (OLTP) and Online Analytics Processing (OLAP) workloads, and so on. The graph database service may be used for processing of streaming data that is rich (e.g., representing a large amount of information) and highly connected (e.g., representing many relationships). For example, clients in the financial sector may use the graph database service to process a stream of credit card transactions as graph queries to identify potential anomalies. As a more specific example, a client of the graph database service may supply a graph query to detect a purchase that takes place in one geographical region and is followed by one in another geographical region five minutes later. Detecting that a customer had two transactions that occurred closely together, but took place thousands of miles apart, the client of the graph database service may generate an alert and send it to the customer. As another example, the graph database service may be used by a retail company to make purchase recommendations for a customer based on purchasing behavior of the customer's friends. As yet another example, the graph database service may be used by a life sciences organization to analyze the relationships between different chemicals and compounds to detect drug interactions.
[0016] The graph database service may be used by clients for combining and analyzing the large quantities of relationship information aggregated in the clients' OLTP and OLAP applications. Beyond short interactive queries (e.g., for OLTP) and longer-running complex queries (e.g., for OLAP), graph analytics using the graph database service may produce new insights by analyzing entire collections of relationships. Graph analytics may use iterative algorithms to process very large graphs and mine them for new information. Examples of such graph analytics may include using search engine algorithms for detecting web page relevance, using a community detection algorithm to detect groups of similar users from a large social network, and executing a shortest path algorithm to find the lowest cost route from point A to point B on a network of roads. Such tasks may be computationally challenging for conventional databases (e.g., relational databases) because they often require visiting all of the relationships (edges) in the graph multiple times to converge on a result.
[0017] The graph database service supports incoming and outgoing streams of graph data. The graph database service may be used in conjunction with machine-learning and deep-learning applications and services such that relationship-rich data in the graph database can be analyzed to identify areas in which to use machine-learning algorithms. The graph database service may be used to represent and scale knowledge graphs. The graph database service provides native support for processing large quantities of relationship information. The graph database service natively supports both the property graph and resource description framework (RDF) graph models to permit flexibility in modelling data on behalf of clients. Queries may explore small parts of the graph (e.g. OLTP applications such as recommendation systems), explore large parts of the graph (e.g., lightweight OLAP applications such as fraud detection), or examine the whole graph repeatedly (e.g., graph analytics such as determining relevance via page rank).
[0018] The graph database service provides support for multiple availability zones within a provider network; if the primary cluster node fails, the graph database service may automatically detect the failure, select one from the available standby cluster nodes, and promote the standby to become the new primary. The graph database service may propagate the DNS changes of the promoted replica so that the client's application can keep writing to the primary endpoint. The graph database service may also provision a new node to replace the promoted standby node in the same availability zone of the failed primary one. In case the primary node failed due to temporary availability zone disruption, the new replica may be launched automatically by the graph database service once that availability zone has recovered. The graph database service supports snapshots (automatic and on-demand) that can be restored via the console and application programming interface (API).
[0019] The client 180 may encompass any type of client suitable to submit data and requests to the graph database service. The client may be one of many clients of the graph database service. The client may include one or more services or applications that seek to make use of the graph database service. The client may convey network-based service requests to the service via one or more networks. The network(s) may encompass any suitable combination of networking hardware and protocols necessary to establish network-based communications between the client and the graph database service. For example, the network(s) may generally encompass the various telecommunications networks and service providers that collectively implement the Internet. The network(s) may also include private networks such as local area networks (LANs) or wide area networks (WANs) as well as public or private wireless networks. For example, both the client and the graph database service may be respectively provisioned within enterprises having their own internal networks. The network(s) may include the hardware (e.g., modems, routers, switches, load balancers, proxy servers, etc.) and software (e.g., protocol stacks, accounting software, firewall / security software, etc.) necessary to establish a networking link between the given client and the Internet as well as between the Internet and the graph database service. The client may communicate with the graph database service using a private network rather than the public Internet.
[0020] The graph database service may include one or more computing devices, any of which may be implemented by the example computing device 3000 illustrated in FIG. 7, and any suitable storage resources. Similarly, the client may be implemented using the example computing device 3000 illustrated in FIG. 7. Portions of the described functionality of the service 100, database 140, and / or client 180 may be provided by the same computing device or by any suitable number of different computing devices. If any of the components are implemented using different computing devices, then the components and their respective computing devices may be communicatively coupled, e.g., via a network. Each of the illustrated components (such as the graph database service and its constituent components) may represent any combination of software and hardware usable to perform their respective functions. The graph database service and / or graph database may include additional components not shown, fewer components than shown, or different combinations, configurations, or quantities of the components shown.
[0021] FIG. 2A illustrates an example of a graph database usable with the example system environment, including the creation of per-column indices for globally scoped column names. The graph database service stores data as triples in a triple table 150. The triples used in the graph database service may differ from the triples in the RDF graph model, in which a triple may include a subject, predicate, and an object. The storage model used by the graph database service can effectively store and process both the property graph model and the RDF model using its internal triples structure. In the illustrated example, the triple table includes at least the illustrated eleven triples. The triples include subject identifiers 201, column names or properties 202, and values 203 associated with the column names or properties. The subject identifiers are referred to as identifiers or row identifiers. The identifiers 201 may indicate the particular row (e.g., in a relational view of the data) or record that holds the combination of the column name and the value in the triple. As shown in the example of FIG. 2A, the same subject identifier may be reused for multiple triples, e.g., if the corresponding row or record includes values in multiple categories. The column names or properties 202 may indicate a distinct and separate category of data, and the values 203 may represent one of the allowable values within the category. The triples in the triple table may be used to represent nodes and edges (relationships) in a graph of connected items. For example, the rows including identifier P101 may represent a node for a particular person having properties such as the name "Firstname Lastname" and the age 32. The node for identifier P101 may also be connected to a node for a personal address (myAddr) A201. As shown in the example, the address A201 has additional triples in the triple table indicating values for street address, city, and zip code properties. Similarly, the rows including identifier B101 may represent a node for a particular business having properties such as the name "AtoZ Corporation" and a connection to a node for a business address (busAddr) A202.
[0022] Columns are strongly typed such that values in a particular column share the same data type, and an enforcement mechanism may ensure that values in the particular column are limited to being expressed in the data type associated with the column. Data types may differ from column to column. As shown in the example of FIG. 2A, the "name" column may be associated with a string data type, while the "zip" column may be associated with a numeric data type. Clients are permitted to create columns that appear to be locally scoped but are actually implemented in the graph database with a global scope, e.g., by automatically appending an additional term to a potentially non-unique column name to ensure that the combination is unique in the graph database.
[0023] The index creation component may create and maintain indices for every global column in the triple table. The index creation component may create and maintain indices for many but not necessarily all global columns in the triple table, e.g., for columns that are intended to be queryable or searchable. As shown in the example of FIG. 2A, the index creation component may create and maintain a "name" index 160A corresponding to the column name or property "name," a "city" index 160B corresponding to the column name or property "city," a "zip" index 160C corresponding to the column name or property "zip," an "age" index 160D corresponding to the column name or property "age," a "myAddr" index 160E corresponding to the column name or property "myAddr," a "busAddr" index 160F corresponding to the column name or property "busAddr," and a "street" index 160G corresponding to the column name or property "street." The per-column or property-scoped indices 160A-160G be tables or other columnar data structures that include one or more rows, and each row may include the values associated with the column corresponding to the index. Each row in a per-column index also includes a pointer to the corresponding row in the primary table in the graph database; the pointer may take the form of a subject identifier. The indices may effectively be partitioned by column name. By way of contrast, such per-column indexing in a conventional relational database would often be prohibitively expensive due to the vastly greater number of locally scoped columns that may be managed in a relational database management system. The generation and maintenance of indices is performed by the graph database service automatically, e.g., without being directly prompted by user input directing the indexing tasks. By way of contrast, the generation and maintenance of indices for a conventional relational database is typically a manual task that requires user input to customize the indices.
[0024] The data elements in the graph database may include elements in addition to the subject identifiers, column names (also known as properties or predicates), and values (also known as objects or relationships). The data elements may be referred to as quads, e.g., when each row potentially stores four different units of data. As illustrated in FIG. 2B, the data elements also include graph identifiers 204 that indicate particular graphs or sub-graphs to which the triples belong. As illustrated in FIG. 2C, the data elements also include one or more types of annotations 205A-205G. The triple table 150 stores annotations that characterize aspects of the triples, such as the values in the triples. As shown in the example of FIG. 2C, a series of annotation fields such as annotation 205A through 205G may be stored in the triple table. However, any suitable number and configuration of annotation fields may be used in the graph database in various embodiments. The annotations may represent user-defined or user-supplied values for aspects of data such as data quality values, access rights, expiration times, and so on. For a given annotation field, not all of the triples or rows may include a value for that annotation field. In the example shown in FIG. 2C, only the "P101"-"name"-"Firstname Lastname" and "B101"-"name"-"AtoZ Corporation" triples include values for the annotation field 205A. Also in the example shown in FIG. 2C, a greater number of the triples happen to have values for the annotation field 205G.
[0025] FIG. 3 illustrates an example of a graph database usable with the example system environment, including a relational view of data elements in the graph database, according to one embodiment. The graph database is sufficiently flexible to describe rich interrelated object and relationship centric data while also achieving query performance using property-scoped, strongly typed indices. As shown in the example of FIG. 3, the graph database may reflect or represent a relational view 210 of data along with its associated per-column, property-scoped indices. For example, the rows including identifier P101 may represent a row in the relational view for a particular person 220 having properties such as the name "Firstname Lastname," the age 32, and the personal address (myAddr) A201. Similarly, the rows including identifier B101 may represent a row in the relational view for a particular business 230 having properties such as the name "AtoZ Corporation" and a business address (busAddr) A202. The relational view may also include a table for the addresses 240 referenced in the person 220 and business 230 rows.
[0026] FIG. 4 illustrates an example of a graph database usable with the example system environment, including an entity view of data elements in the graph database. The graph database may reflect or represent an entity view 250 of data along with its associated per-column, property-scoped indices. The entity view may include one or more entities expressed according to JavaScript Object Notation (JSON). For example, the rows including identifier P101 may represent an entity 260 in the entity (JSON) view for a particular person having properties such as the name "Firstname Lastname," the age 32, and the personal address (myAddr) A201 with nested values for a city, street, and zip code. Similarly, the rows including identifier B 101 may represent another entity 270 in the entity (JSON) view for a particular business having properties such as the name "AtoZ Corporation" and a business address (busAddr) A202 with nested values for a city, street, and zip code.
[0027] FIG. 5 illustrates the generation of statistics associated with per-column indices for globally scoped column names. As previously shown in the example of FIG. 2, the index creation component may create and maintain a "name" index 160A corresponding to the column name or property "name," a "city" index 160B corresponding to the column name or property "city," a "zip" index 160C corresponding to the column name or property "zip," an "age" index 160D corresponding to the column name or property "age," a "myAddr" index 160E corresponding to the column name or property "myAddr," a "busAddr" index 160F corresponding to the column name or property "busAddr," and a "street" index 160G corresponding to the column name or property "street." The statistics generation component generates and maintains statistics for the indices 160A-160G in order to optimize queries. The statistics are incrementally generated by being updated periodically as triples are added, deleted, or modified. The statistics generation component generates and maintains sets of statistics corresponding to individual indices, such as statistics 121A-121G corresponding to the indices 160A-160G. The statistics may be stored using any suitable storage technologies, e.g., in storage managed by or otherwise accessible to the graph database service. The statistics for an index may represent distributions of values within the corresponding column. For example, the statistics may indicate how many times a particular value occurs within the column, how many triples having numeric values within a particular numeric range occur within the column, how many triples having string-typed values beginning with a particular character occur within the column, and so on.
[0028] To optimize a query, the order of indices to be used may be determined based (at least in part) on the statistics 121A-121G for the per-column indices 160A-160G. The query planner uses the most constraining index first, then the next most constraining index, and so on. The statistics may be maintained in real time or near-real time to enable optimized query processing using up-to-date information. The generation and maintenance of statistics for an index is performed by the graph database service automatically, e.g., without being directly prompted by user input directing the statistics tasks. An index and the corresponding statistics for the index are updated by the graph database service in response to the updating of one or more triples for the corresponding column in the graph database (e.g., the addition of one or more triples, the deletion of one or more triples, or the modification of one or more triples).
[0029] FIG. 6 is a flowchart illustrating a method for global column indexing in a graph database. As shown in 610, elements of data may be stored or updated in a graph database. The elements of data in the graph database may represent triples or rows in a columnar format. For example, a triple may include an identifier, a column name, and a value. Triples may include different elements in addition to an identifier, column, name, and value. The identifier may also be referred to as a subject identifier. The identifier may indicate the particular row (e.g., in a relational view of the data) or record that holds the combination of the column name and the value in the triple. The same subject identifier may be reused for multiple triples, e.g., if the corresponding row or record includes values in multiple categories. The column name may indicate a distinct and separate category of data, and the value may represent one of the allowable values within the category. The triples in a graph database may be used to represent nodes and edges (relationships) in a graph of connected items. The graph database may store one graph or multiple graphs. The triples are also stored with graph identifiers that indicate particular graphs to which the triples belong.
[0030] Columns are strongly typed such that values in a particular column share the same data type, and an enforcement mechanism may ensure that values in the particular column are limited to being expressed in the data type associated with the column. Data types may differ from column to column. All the rows and columns in the graph database may effectively belong to the same primary table. Column names are globally scoped in the graph database, such that the same column name may not be represented more than once in the graph database and may not be limited to a particular sub-table of the graph database. By way of contrast, column names in a conventional relational database are typically locally scoped to one of many tables.
[0031] As shown in 620, indices may be created or updated for the globally scoped columns in the primary table in the graph database. Indices are created and maintained for many but not necessarily all global columns in the primary table in the graph database, e.g., for columns that are intended to be queryable or searchable. A per-column index may be a table or other columnar data structure that includes multiple rows, and each row may include the values associated with the column corresponding to the index. A per-column index may also be referred to as a property-scoped index. Each row in a per-column index also includes a pointer to the row in the primary table in the graph database. The indices may be stored as separate data structures from each other and from the primary table, e.g., in storage managed by or otherwise accessible to the graph database service. The indices may effectively be partitioned by column name. By way of contrast, such per-column indexing in a conventional relational database would often be prohibitively expensive due to the vastly greater number of locally scoped columns that may be managed in a relational database management system. The generation and maintenance of indices is performed by the graph database service automatically, e.g., without being directly prompted by user input directing the indexing tasks. By way of contrast, the generation and maintenance of indices for a conventional relational database is typically a manual task that requires user input to customize the indices.
[0032] As shown in 630, statistics may be generated or updated incrementally for the indices, e.g., in order to optimize queries. The statistics may be stored using any suitable storage technologies, e.g., in storage managed by or otherwise accessible to the graph database service. The statistics for an index may represent distributions of values within the corresponding column. For example, the statistics may indicate how many times a particular value occurs within the column, how many triples having numeric values within a particular numeric range occur within the column, how many triples having string-typed values beginning with a particular character occur within the column, and so on. The statistics may be maintained in real time or near-real time to enable optimized query processing using up-to-date information. The generation and maintenance of statistics for an index is performed by the graph database service automatically, e.g., without being directly prompted by user input directing the statistics tasks. An index and the statistics for the index are updated by the graph database service in response to the updating of one or more triples for the corresponding column in the graph database (e.g., the addition of one or more triples, the deletion of one or more triples, or the modification of one or more triples).
[0033] As shown in 640, it may be determined whether a query has been received, e.g., from a client or any user who has suitable access privileges to submit a query to the graph database service. If not, then the method may await update requests to the graph database and eventually return to 610 to perform the updates (e.g., the addition of one or more triples, the deletion of one or more triples, or the modification of one or more triples). If a query has been received, then as shown in 650, the query may be performed on the graph database. The query is performed (e.g., by a query planner) using the indices corresponding to column names associated with the query. To optimize a query, the order of indices to be used may be determined based (at least in part) on the statistics for the per-column indices. The query planner uses the most constraining index first, then the next most constraining index, and so on. The query may return one or more data elements from the graph database, potentially including one or more of the values.Illustrative Computer System
[0034] A computer system that implements a portion or all of one or more of the technologies described herein may include a computer system that includes or is configured to access one or more computer-readable media. FIG. 7 illustrates such a computing device 3000 in one embodiment. Computing device 3000 includes one or more processors 3010A-3010N coupled to a system memory 3020 via an input / output (I / O) interface 3030. Computing device 3000 further includes a network interface 3040 coupled to I / O interface 3030.
[0035] Computing device 3000 may be a uniprocessor system including one processor or a multiprocessor system including several processors 3010A-3010N (e.g., two, four, eight, or another suitable number). Processors 3010A-3010N may include any suitable processors capable of executing instructions. For example, processors 3010A-3010N may be processors implementing any of a variety of instruction set architectures (ISAs), such as the x86, PowerPC, SPARC, or MIPS ISAs, or any other suitable ISA. In multiprocessor systems, each of processors 3010A-3010N may commonly, but not necessarily, implement the same ISA.
[0036] System memory 3020 may be configured to store program instructions and data accessible by processor(s) 3010A-3010N. System memory 3020 may be implemented using any suitable memory technology, such as static random access memory (SRAM), synchronous dynamic RAM (SDRAM), nonvolatile / Flash-type memory, or any other type of memory. Program instructions and data implementing one or more desired functions, such as those methods, techniques, and data described above, are shown stored within system memory 3020 as code (i.e., program instructions) 3025 and data 3026.
[0037] I / O interface 3030 may be configured to coordinate I / O traffic between processors 3010A-3010N, system memory 3020, and any peripheral devices in the device, including network interface 3040 or other peripheral interfaces. I / O interface 3030 may perform any necessary protocol, timing or other data transformations to convert data signals from one component (e.g., system memory 3020) into a format suitable for use by another component (e.g., processor 3010). I / O interface 3030 may include support for devices attached through various types of peripheral buses, such as a variant of the Peripheral Component Interconnect (PCI) bus standard or the Universal Serial Bus (USB) standard, for example. The function of I / O interface 3030 may be split into two or more separate components, such as a north bridge and a south bridge, for example. Some or all of the functionality of I / O interface 3030, such as an interface to system memory 3020, may be incorporated directly into processors 3010A-3010N.
[0038] Network interface 3040 may be configured to allow data to be exchanged between computing device 3000 and other devices 3060 attached to a network or networks 3050. Network interface 3040 may support communication via any suitable wired or wireless general data networks, such as types of Ethernet network, for example. Network interface 3040 may support communication via telecommunications / telephony networks such as analog voice networks or digital fiber communications networks, via storage area networks such as Fibre Channel SANs, or via any other suitable type of network and / or protocol.
[0039] System memory 3020 may be a computer-readable (i.e., computer-accessible) medium configured to store program instructions and data as described above for implementing embodiments of the corresponding methods and apparatus. However, program instructions and / or data may be received, sent or stored upon different types of computer-readable media. Generally speaking, a computer-readable medium may include non-transitory storage media or memory media such as magnetic or optical media, e.g., disk or DVD / CD coupled to computing device 3000 via I / O interface 3030. A non-transitory computer-readable storage medium may also include any volatile or non-volatile media such as RAM (e.g. SDRAM, DDR SDRAM, RDRAM, SRAM, etc.), ROM, etc., that may be included in some embodiments of computing device 3000 as system memory 3020 or another type of memory. A computer-readable medium may include transmission media or signals such as electrical, electromagnetic, or digital signals, conveyed via a communication medium such as a network and / or a wireless link, such as may be implemented via network interface 3040. Portions or all of multiple computing devices such as that illustrated in FIG. 7 may be used to implement the described functionality in various embodiments; for example, software components running on a variety of different devices and servers may collaborate to provide the functionality. Portions of the described functionality may be implemented using storage devices, network devices, or various types of computer systems. The term "computing device" refers to at least all these types of devices, and is not limited to these types of devices.
Claims
1. A system, comprising: a graph database service (100) comprising one or more processors (3010A-N) and a memory (3020) to store computer-executable instructions that, when executed, cause the one or more processors to: store a plurality of items of a graph database (140) in a triple store table, wherein individual items of the graph database comprise at least an identifier (201), a property (202) and a value for the property (203), wherein more than one item of the graph database comprises a same particular property, and wherein individual properties of the items are associated with a respective data type for the corresponding values for the property, such that all the values for the particular property of the graph database share the same data type that is associated with the particular property; create indices (160A-G) corresponding to the properties, wherein an individual one of the indices corresponds to an individual one of the properties, and wherein the individual one of the indices comprises one or more of the values associated with the corresponding property; and perform a query on the graph database, wherein the query on the graph database is performed using one or more of the indices corresponding to one or more of the properties associated with the query.
2. The system as recited in claim 1, wherein the query is performed by the graph database service responsive to a request from a client, and wherein the query identifies one or more anomalous activities.
3. The system as recited in claim 1, wherein the query is performed by the graph database service responsive to a request from a client, and wherein the query is used to generate one or more recommendations.
4. The system as recited in claim 1, wherein the graph database stores streaming data.
5. The system as recited in claim 1, wherein the properties comprise data about vertices and edges of a property graph.
6. The system as recited in claim 1, wherein the items comprise one or more annotations.
7. A method, comprising: storing a plurality of items of a graph database (140) in a triple store table, wherein individual items of the graph database comprise at least an identifier (201), a property (202) and a value (203) for the property, wherein more than one item of the graph database comprises a same particular property, and wherein individual properties of the items are associated with a respective data type for the corresponding values for the property, such that all the values for the particular property of the graph database share the same data type that is associated with the particular property; creating indices (160A-G) corresponding to the properties, wherein an individual one of the indices corresponds to an individual one of the properties, and wherein the individual one of the indices comprises one or more of the values associated with the corresponding property; and performing a query on the graph database, wherein the query on the graph database is performed using one or more of the indices corresponding to one or more of the properties associated with the query.
8. The method as recited in claim 7, wherein the query is performed by a graph database service responsive to a request from a client, and wherein the query identifies one or more anomalous activities.
9. The method as recited in claim 7, wherein the query is performed by a graph database service responsive to a request from a client, and wherein the query is used to generate one or more recommendations.
10. The method as recited in claim 7, wherein the graph database stores streaming data.
11. The method as recited in claim 7, wherein the properties comprise data about vertices and edges of a property graph.
12. The method as recited in claim 7, wherein the items comprise one or more annotations.
13. The method as recited in claim 7, further comprising: performing graph analytics associated with the graph database.
14. One or more non-transitory computer-readable storage media storing program instructions that, when executed on or across one or more processors, perform the method of any of claims 7 to 13.