IP Library Granted Patent US 10,929,396
Granted Patent B1
US 10,929,396 · App. 15/818,687 · Granted Feb 23, 2021

Multi-type attribute index for a document database

Inventors: Sandeep Bhatia (Bothell, WA); Kanishka Chaturvedi (Seattle, WA); Maruthi Manohar Reddy Devarenti (Renton, WA); VamsiKrishna Chaitanya Manchem (Kirkland, WA); Andrew Whitaker (Seattle, WA); Ming-chuan Wu (Bellevue, WA)
Assignee: Amazon Technologies, Inc.
G06F16/24542G06F9/547G06F16/81G06F16/93
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,929,396
App. No.
15/818,687
Granted
Feb 23, 2021
Kind
B1
Abstract

Multi-type attribute indexes may be implemented for document databases. When a request to perform a query at a document database is received that is directed toward in indexed attribute that has multiple data types for values stored in the multi-type attribute index, a predicate in the query may be replaced with a different predicate that is applicable to search the multi-type attribute index according to a sort order for the multiple data types stored in the at multi-type attribute index. A plan that includes the different predicate may be performed in order to provide a result of the query to a user.

Claims (58)

1. A system, comprising:

a memory to store program instructions which, if performed by at least one processor, cause the at least one processor to perform a method to at least:

receive a request to perform a query at a document database that includes a first predicate for an attribute of documents stored in the document database, wherein different respective values of the attribute include a plurality of data types;

generate a plan to perform the query that replaces the first predicate with a second predicate applicable to search an index for the attribute according to a sorted order for the data types of the different respective values in the index;

perform the query according to the plan; and

return a result of the query to a client.

2. The system of claim 1 , wherein the program instructions cause the at least one processor to perform the method to further:

receive a request to create the index for the attribute;

in response to the receipt of the request to create the index:

scan the documents of the document database to obtain the respective values from the documents of the document database; and

insert the respective values into the index using comparison operations that implement the sorted order for the data types.

3. The system of claim 2 , wherein at least one of the respective values is a multi-value attribute, and wherein to insert the respective values into the index, the program instructions cause the at least one processor to perform the method to:

insert individual values of the multi-value attribute in separate entries of the index; and

insert the multi-value attribute in another entry of the index.

4. The system of claim 1 , wherein the at least one processor and the memory are implemented as part of a network-based database service, wherein the document database is stored in the database service on behalf of a client of the database service, and wherein the query is received via an Application Programming Interface (API) for the network-based service.

5. A method, comprising:

receiving a request to perform a query at a document database that includes a first predicate for an attribute of documents stored in the document database, wherein different respective values of the attribute include a plurality of data types;

replacing the first predicate in a plan to perform the query with a second predicate applicable to search an index for the attribute according to a sorted order for the data types of the different respective values in the index;

performing the query according to the plan; and

returning a result of the query to a client.

6. The method of claim 5 , wherein the second predicate includes a predicate that excludes one or more of the data types according to the sort order for the data types.

7. The method of claim 5 , further comprising updating the index to include an additional value of the attribute stored in the document database using one or more comparison operations that implement the sorted order for the data types.

8. The method of claim 5 , wherein performing the query according to the query plan, comprises:

determining that the index does not store a multi-value attribute; and

response to the determining, including an additional predicate with the second predicate to be applied when searching the index.

9. The method of claim 5 , wherein performing the query according to the query plan comprises:

determining that the index does store a multi-value attribute; and

response to the determining, applying an additional predicate to intermediate results from the search of the index applying the second predicate.

10. The method of claim 5 , wherein the plan further comprises an operation to remove duplicate documents returned from an evaluation of the index.

11. The method of claim 5 , further comprising:

receiving a request to create the index for the attribute;

in response to receiving the request to create the index:

obtaining the respective values from the documents of the document database; and

inserting the respective values into the index using comparison operations that implement the sorted order for the data types.

12. The method of claim 11 , wherein at least one of the respective values is a multi-value attribute, and wherein inserting the respective values into the index comprises:

inserting individual values of the multi-value attribute in separate entries of the index; and

inserting the multi-value attribute in another entry of the index.

13. The method of claim 11 , wherein the index is a b-tree, and wherein inserting the respective values into the index comprises identifying respective leaf nodes for the respective values according to the comparison operations.

14. A non-transitory, computer-readable storage medium, storing program instructions that when executed by one or more computing devices cause the one or more computing devices to implement:

receiving a request to perform a query at a document database that includes a first predicate for an attribute of documents stored in the document database, wherein different respective values of the attribute include a plurality of data types;

rewriting the first predicate to replace the first predicate with a second predicate a second predicate applicable to search an index for the attribute according to a sorted order for the data types of the different respective values in the index;

including the second predicate as part of a plan to perform the query;

performing the query according to the plan; and

returning a result of the query to a client.

15. The non-transitory, computer-readable storage medium of claim 14 , wherein the program instructions cause the one or more computing devices to further implement:

receiving a request to create the index for the attribute;

in response to receiving the request to create the index:

scanning the documents of the document database to obtain the respective values from the documents of the document database; and

inserting the respective values into the index using comparison operations that implement the sorted order for the data types.

16. The non-transitory, computer-readable storage medium of claim 15 , wherein at least one of the respective values is a multi-value attribute, and wherein, in inserting the respective values into the index, the program instructions cause the one or more computing devices to implement:

inserting individual values of the multi-value attribute in separate entries of the index; and

inserting the multi-value attribute in another entry of the index.

17. The non-transitory, computer-readable storage medium of claim 16 , wherein in performing the query according to the plan, the program instructions cause the one or more computing devices to implement applying the second predicate to the separate entries of the individual values in the index and the other entry of the multi-attribute value of the index.

18. The non-transitory, computer-readable storage medium of claim 14 , wherein the second predicate includes a predicate that excludes one or more of the data types according to the sort order for the data types.

19. The non-transitory, computer-readable storage medium of claim 14 , wherein, in performing the query according to the query plan, the program instructions cause the one or more computing devices to implement:

determining that the index does not store a multi-value attribute; and

response to the determining, including an additional predicate with the second predicate to be applied when searching the index.

20. The non-transitory, computer-readable storage medium of claim 14 , wherein the one or more computing devices are implemented as part of a network-based database service, wherein the document database is stored in the database service on behalf of a client of the database service, and wherein the query is received via an Application Programming Interface (API) for the network-based service.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 21, 2017
From: BHATIA, SANDEEP; CHATURVEDI, KANISHKA; DEVARENTI, MARUTHI MANOHAR REDDY; MANCHEM, VAMSIKRISHNA CHAITANYA; WHITAKER, ANDREW; WU, MING-CHUAN
To: AMAZON TECHNOLOGIES, INC.
Reel/Frame 044188/0368 →
Cited By (1)
US 12,688,039