IP Library Granted Patent US 10,545,962
Granted Patent B2
US 10,545,962 · App. 15/415,186 · Granted Jan 28, 2020

Relational database instruction validation

Inventors: Jesse Collins (Oakland, CA); Xuerong Tang (San Francisco, CA); Scott Hansma (Burlingame, CA)
Assignee: SALESFORCE.COM, INC.
G06F16/2456G06F16/284
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,545,962
App. No.
15/415,186
Granted
Jan 28, 2020
Kind
B2
Abstract

In an example, a database system may be configured to validate relational database instructions using a plurality of validators. In some examples, validation may be pre-production for relational database instructions based on simulated user inputs and/or file, such as plan files (e.g., PL/SQL (procedural language/structured query language) files). In some examples, validation may be in production for relational database instructions based on system views of a database engine.

Claims (60)

1. A database system, comprising:

a processing system; and

a memory device coupled to the processing system and including instructions stored thereon that, in response to execution by the processing system, are operable to:

identify an instruction generation module configured to automatically generate relational database instructions based on communications from user systems;

generate a simulated user input to feed into the instruction generation module to identify a relational database instruction based on the simulated user input to obtain a candidate relational database instruction to be input into a validation module,

wherein the validation module includes validators including one or more parser based validators that are configured to parse structured query language text into a parse tree to identify elements and one or more rule-based validators including at least one of a syntax validator or a plan validator, and wherein at least one of the one or more parser based validators is configured to use at least one of the one or more rule based validators;

select a subset of the validators of the validation module for a given obtained candidate relational database instruction, and provide that instruction to the selected validators;

identify a plan file including one or more procedural language elements to be accessed by the database system during operation of the instruction generation module;

identify a relational database instruction corresponding to the plan file; and

analyze the relational database instruction that corresponds to the plan file using selected validator(s) of the one or more rule-based validators;

validate the candidate relational database instruction based on the simulated user input using the at least one parser based validator, wherein a validation using the at least one parser based validator is based on a result of applying predefined rules corresponding to the at least one rule based validator; and

output an indication based on whether an error and/or performance issue is detected based on a result of the validation and automatically file a bug report with detailed reasoning about the error and/or performance issue.

2. The database system of claim 1 , wherein the plan validator is configured to ascertain whether the relational database instruction corresponding to the plan file includes a predefined table operation to operate on a predefined table type or a table having an attribute corresponding to a predefined attribute.

3. The database system of claim 2 , wherein the predefined table operation comprises at least one of full scan or full index scan.

4. The database system of claim 2 , wherein the predefined table type comprises tables larger than a threshold size.

5. The database system of claim 1 , wherein the plan validator is configured to:

ascertain whether the relational database instruction corresponding to the plan file includes a nested loop table operation; and

in the case that the relational database instruction corresponding to the plan file does include the nested loop operation, identify whether the relational database instruction corresponding to the plan file includes a valid index for columns of a join of the nested loop table operation.

6. The database system of claim 1 , wherein the plan validator is configured to:

ascertain whether the relational database instruction corresponding to the plan file includes a hash join table operation; and

in the case that the relational database instruction corresponding to the plan file does include the hash join table operation, identify whether the hash join table operation includes a filter.

7. The database system of claim 1 , wherein the plan validator is configured to:

ascertain whether the relational database instruction corresponding to the plan file includes at least one of a semi-join table operation or an anti-join table operation; and

in the case that the relational database instruction corresponding to the plan file does include the semi-join table operation or the anti-join table operation, identify whether a table operation type indicated by a plan tree node corresponds to a table operation type indicated by a join hint of the relational database instruction corresponding to the plan file.

8. The database system of claim 1 , wherein the at least one parser based validator is configured to:

parse a target relational database instruction into a parse tree, wherein the parse tree includes elements comprising at least one of tables, columns in filters, columns in join conditions, or a relational database instruction hint;

identify an element of the elements of the parse tree; and

apply a corresponding predefined rule of the predefined rules to the identified element.

9. The database system of claim 1 , wherein the plan validator comprises an explain plan validator configured to obtain an explain plan from a database engine of a relational database.

10. The database system of claim 9 , wherein the explain plan includes a plan tree structure including a plurality of nodes.

11. The database system of claim 1 , wherein the plan validator is configured to:

compare table operations of a plurality of nodes of a plan tree structure obtained from a relational database to a list of predefined table operations;

apply a corresponding predefined rule of the predefined rules responsive to a result of the comparison.

12. The database system of claim 1 , wherein the database system is further configured to:

parse the relational database instruction corresponding to the plan file into a parse tree; and

extract, from the parse tree, transformation information to be used by the one or more rule-based validators.

13. The database system of claim 12 , wherein the transformation information includes at least one of filter columns, join columns, or table identities.

14. The database system of claim 13 , wherein the table identities comprise table names or table aliases.

15. A method, comprising:

identifying an instruction generation module configured to automatically generate relational database instructions based on communications from one or more user systems;

generating a simulated user input to feed into the instruction generation module to identify a relational database instruction based on the simulated user input to obtain a candidate relational database instruction to be input into a validation module,

wherein the validation module includes validators including one or more parser based validators that are configured to parse structured query language text into a parse tree to identify elements and one or more rule-based validators including at least one of a syntax validator or a plan validator, and wherein at least one of the one or more parser based validators is configured to use at least one of the one or more rule based validators;

selecting a subset of the validators of the validation module for a given obtained candidate relational database instruction, and providing that instruction to the selected validators;

identifying a plan file including one or more procedural language elements to be accessed by a database system during operation of the instruction generation module;

identifying a relational database instruction corresponding to the plan file; and

analyzing the relational database instruction that corresponds to the plan file using selected validator(s) of the one or more rule-based validators;

validating the candidate relational database instruction based on the simulated user input using the at least one parser based validator, wherein a validation using the at least one parser based validator is based on a result of applying predefined rules corresponding to the at least one rule based validator; and

outputting an indication based on whether an error and/or performance issue is detected based on a result of the validation and automatically filing a bug report with detailed reasoning about the error and/or performance issue.

16. The method of claim 15 , wherein the plan validator is configured to ascertain whether the relational database instruction corresponding to the plan file includes a predefined table operation to operate on a predefined table type or a table having an attribute corresponding to a predefined attribute.

17. The method of claim 15 , further comprising:

parsing the relational database instruction corresponding to the plan file into a parse tree; and

extracting, from the parse tree, transformation information to be used by the one or more rule-based validators.

18. The method of claim 17 , wherein the transformation information includes at least one of filter columns, join columns, or table identities.

19. The method of claim 15 , wherein the at least one parser based validator is configured to:

parse a target relational database instruction into a parse tree, wherein the parse tree includes elements comprising at least one of tables, columns in filters, columns in join conditions, or a relational database instruction hint;

identify an element of the elements of the parse tree; and

apply a corresponding predefined rule of the predefined rules to the identified element.

20. The method of claim 15 , wherein the plan validator is configured to:

compare table operations of a plurality of nodes of a plan tree structure obtained from a relational database to a list of predefined table operations;

apply a corresponding predefined rule of the predefined rules responsive to a result of the comparison.

Assignments (2)
CHANGE OF NAME Recorded Oct 30, 2023
From: SALESFORCE.COM, INC.
To: SALESFORCE, INC.
Reel/Frame 065394/0169 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 25, 2017
From: COLLINS, JESSE; TANG, XUERONG; HANSMA, SCOTT
To: SALESFORCE.COM, INC.
Reel/Frame 041081/0037 →
Continuity (1)
Related Publication 20180210909A1 · Jul 26, 2018