CN111831659B - Index checking method and device and computing equipment - Google Patents

Index checking method and device and computing equipment Download PDF

Info

Publication number
CN111831659B
CN111831659B CN202010658713.2A CN202010658713A CN111831659B CN 111831659 B CN111831659 B CN 111831659B CN 202010658713 A CN202010658713 A CN 202010658713A CN 111831659 B CN111831659 B CN 111831659B
Authority
CN
China
Prior art keywords
data
database
data access
index
field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010658713.2A
Other languages
Chinese (zh)
Other versions
CN111831659A (en
Inventor
韩天伟
李荣尊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Chezhijia Data Information Technology Co ltd
Original Assignee
Tianjin Chezhijia Data Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Chezhijia Data Information Technology Co ltd filed Critical Tianjin Chezhijia Data Information Technology Co ltd
Priority to CN202010658713.2A priority Critical patent/CN111831659B/en
Publication of CN111831659A publication Critical patent/CN111831659A/en
Application granted granted Critical
Publication of CN111831659B publication Critical patent/CN111831659B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method, a device and a computing device for checking indexes, wherein the method comprises the following steps: extracting a data access statement in an application, the data access statement being adapted to be executed in the application to access a database in a data storage device coupled to the application, the database comprising one or more data tables, each data table comprising one or more fields, wherein one or more fields are index fields; extracting a data table and a condition field in a database to be accessed from a data access statement; querying an index field list corresponding to the data table from the data storage device; and judging whether the inquired index field list comprises a condition field or not, and if not, sending a prompt so as to set a field corresponding to the condition field in a data table of a database of the data storage device as the index field.

Description

Index checking method and device and computing equipment
Technical Field
The invention relates to the technical field of computers, in particular to a method, a device and computing equipment for checking indexes.
Background
In recent years, relational databases are increasingly widely used, and since the relational databases are collections of interrelated data tables, access or query to fields in the data tables is a common operation on the relational databases, while the access speed to the fields in the tables is one of the main factors influencing the running speed of programs.
At present, adding indexes to fields of data tables in a relational database is a common method for optimizing the performance of application access databases. The method is based on the fact that a developer determines fields of a data table corresponding to data access statements in a program through memory, indexes are added to corresponding fields in the data table based on the fields, and the program accesses the fields of the data table in a relational database through the indexes. However, the above method is mainly based on human thinking, and is easily affected by the physical state and experience of the developer, and when the developer carelessly or in a poor state, the developer easily forgets to add an index to a field in a data table corresponding to a data access statement, thereby seriously affecting the running rate of a program and the performance realized by the program. Therefore, a scheme for automatically checking the index is to be provided, so as to solve the problem that the operation efficiency of the program and the performance of the program are affected by forgetting to add the field index of the data table in the manual addition relational database.
Disclosure of Invention
In view of the above, the present invention has been made to provide a method, apparatus and computing device for checking an index that overcomes or at least partially solves the above problems.
According to an aspect of the present invention, there is provided a method of checking an index, executed in a computing device, the method comprising:
extracting a data access statement in an application, the data access statement being adapted to be executed in the application to access a database in a data storage device coupled to the application, the database comprising one or more data tables, each data table comprising one or more fields, wherein one or more fields are index fields;
extracting a data table and a condition field in a database to be accessed from the data access statement;
querying an index field list corresponding to the data table from the data storage device;
and judging whether the inquired index field list comprises the condition field or not, if not, sending a prompt so as to set the field corresponding to the condition field in the data table of the database of the data storage device as the index field.
Optionally, the extracting a data access statement in an application includes:
extracting a mapper file from the application;
extracting the data access statement from the mapper file.
Optionally, the extracting the mapper file from the application includes:
selecting all extensible markup language files in the application in a recursive circulation mode;
selecting a file with a root node name as a mapper from the extensible markup language file.
Optionally, the extracting the data access statement from the mapper file comprises:
reading the contents of a particular tag from the mapper file;
setting a return value of a sub-tag in the content of the specific tag to true, wherein the sub-tag is a branch of the content of the specific tag;
and acquiring data access statements corresponding to all sub-tags with the return values of true in the content of the specific tag.
Optionally, the data access statements corresponding to all the sub-tags with the return value of true in the content of the specific tag are obtained through the persistent layer framework.
Optionally, the sub-tag comprises: an if sub-tag and a while sub-tag, the particular tag comprising: one or more of query tags, update tags, and delete tags.
Optionally, the extracting, from the data access statement, a data table and a condition field in a database to be accessed includes:
analyzing the data access statement to obtain a WHERE condition, an association condition and a data table name required to be inquired;
determining the data table in the database to be accessed through the data table name in the database to be accessed; and
determining the condition field by the WHERE condition and the association condition.
Optionally, the first data access statement is parsed through a database connection pool.
Optionally, the database connection pool is a managed connection pool.
According to another aspect of the present invention, there is provided an apparatus residing in a computing device for checking an index, the apparatus comprising:
an extraction unit for extracting a data access statement in an application, the data access statement being adapted to be executed in the application in order to access a database in a data storage device coupled to the application, the database comprising one or more data tables, each data table comprising one or more fields, wherein one or more fields are index fields; and a database for extracting a data table and a condition field in a database to be accessed from the data access statement;
the query unit is used for querying the index field list corresponding to the data table from the data storage equipment;
and the judging unit is used for judging whether the inquired index field list comprises the condition field or not, and if the condition field is not included, sending a prompt so as to set the field corresponding to the condition field in the data table of the database of the data storage device as the index field.
According to yet another aspect of the invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the above-described method.
According to yet another aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the above-described method.
The method for checking the index provided by the invention takes the condition field actually used in the program as the checking condition, compares the condition field with the index actually added to the field in the data table of the database, accords with the actual condition, and prompts a developer to add the index to the field in the data table when finding that the field in the data table corresponding to the condition field is not added with the index, thereby realizing the automatic checking of whether the field in the data table of the database is added with the index or not, and automatically making the prompt of adding the index to the field which is not added with the index in the data table corresponding to the condition field. Therefore, the method for automatically checking the index has high execution efficiency, is suitable for any scene of judging whether the field of the data table in the database is added with the index, and can avoid the situation that the field index of the data table in the database is added by the memory and experience of people easily forgets to add the field index, thereby improving the execution efficiency of the program and realizing the expected performance of the program.
The above description is only an overview of the technical solutions of the present invention, and the present invention can be implemented in accordance with the content of the description so as to make the technical means of the present invention more clearly understood, and the above and other objects, features, and advantages of the present invention will be more clearly understood.
Drawings
Various additional advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 shows a schematic diagram of a system 100 for checking an index according to one embodiment of the invention;
FIG. 2 shows a schematic diagram of a computing device 200, according to one embodiment of the invention;
FIG. 3 illustrates a flow diagram of a method 300 of checking an index according to one embodiment of the invention;
FIG. 4 illustrates a flow diagram of a method 400 of extracting data tables and condition fields in a database to be accessed from a data access statement, according to one embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
At present, increasing indexes to fields of a data table in a relational database is a common method for optimizing the performance of a program access database, and the method is based on that a developer determines fields of the data table corresponding to data access statements in a program by means of memory, and the indexes are increased to corresponding fields in the data table based on the determined fields.
Therefore, the present invention provides a system 100 for checking indexes, which can automatically check whether indexes are added to fields of a data table in a database, and prompt which fields in the data table need to be added with indexes, without a developer remembering to add indexes to corresponding fields in the data table, thereby solving the problems of low program running efficiency and low program performance caused by forgetting to add indexes to fields of the data table manually.
FIG. 1 shows a schematic diagram of a system 100 for checking an index, according to one embodiment of the invention. As shown in FIG. 1, the system 100 for checking an index comprises a data storage device 110 and a computing device 200, wherein the data storage device 110 is connected with the computing device 200 in a communication way, for example, through a network connection in a wired or wireless way. The data storage device 110 includes a database including one or more data tables, each data table including one or more fields, wherein the one or more fields are index fields, and the one or more index fields form an index field list. The computing device 200 includes an application, such as a programming application, which includes all programs under a project, including data access statements, which are adapted to be executed in the application to access a database in a data storage 110 coupled to the application.
The computing device 200 is configured to obtain all programs related to database operations under one project in an application, obtain a data access statement from the program, extract a data table and a condition field in the database to be accessed from the data access statement, query, in the database in the data storage device 110, a list of index fields corresponding to the data table, thereby determining whether all the condition fields are included in the queried list of index fields, and if one or more condition fields are not included, issue a prompt to a developer to set, as an index field, a field corresponding to a condition field in a data table of a database in the data storage device 110. The method realizes automatic check whether the field of the data table in the database is added with the index, and automatically prompts a developer to set the field as the index field under the condition that the index is not added.
In one embodiment, computing device 200 may be implemented as a server, such as an application server, a Web server, or the like; but may also be implemented as a desktop computer, a notebook computer, a processor chip, a tablet computer, etc., but is not limited thereto. The database of data storage 110 may be a relational database, such as MYSQL, SqlServer, etc.; the database of the data storage device 110 may be a local database residing in the computing apparatus 200, wherein the database of the data storage device 110 is used for storing data tables, and the present invention is not limited to the specific deployment and configuration of the data storage device 110 and the database of the data storage device 110. The computing device 200 may connect with the data storage 110 and retrieve data stored by a database in the data storage 110. For example, the computing device 200 may directly read the data of the database in the data storage device 110 (when the database of the data storage device 110 is a local database of the computing device 200), or may access the internet in a wired or wireless manner, and obtain the data of the database in the data storage device 110 through the data interface.
The method of checking an index of the present invention may be performed in the computing device 200. FIG. 2 shows a block diagram of a computing device 200, according to one embodiment of the invention. As shown in FIG. 2, in a basic configuration 202, a computing device 200 typically includes a system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between the processor 204 and the system memory 206.
Depending on the desired configuration, the processor 204 may be any type of processing, including but not limited to: a microprocessor (μ P), a microcontroller (μ C), a Digital Signal Processor (DSP), or any combination thereof. The processor 204 may include one or more levels of cache, such as a level one cache 210 and a level two cache 212, a processor core 214, and registers 216. Example processor core 214 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 218 may be used with the processor 204, or in some implementations the memory controller 218 may be an internal part of the processor 204.
Depending on the desired configuration, system memory 206 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 206 may include an operating system 220, one or more applications 222, and program data 224. The application 222 is actually a plurality of program instructions that direct the processor 204 to perform corresponding operations. In some implementations, the application 222 can be arranged to cause the processor 204 to operate with the program data 224 on an operating system.
Computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via the bus/interface controller 230. The example output device 242 includes a graphics processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices such as a display or speakers via one or more a/V ports 252. Example peripheral interfaces 244 may include a serial interface controller 254 and a parallel interface controller 256, which may be configured to facilitate communications with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 258. An example communication device 246 may include a network controller 260, which may be arranged to facilitate communications with one or more other computing devices 262 over a network communication link via one or more communication ports 264.
The network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In the computing device 200 according to the present invention, the application 222 includes a plurality of program instructions for performing a method of checking an index, which may instruct the processor 204 to perform the method 300 of checking an index of the present invention, so that the computing device 200, by performing the method of checking an index of the present invention, automatically checks whether a field of a data table in a database is added with an index, and automatically prompts a developer to set a field of the data table corresponding to a condition field as an index field if not added.
FIG. 3 shows a flow diagram of a method 300 of checking an index according to one embodiment of the invention. The method 300 is suitable for execution in a computing device, such as the computing device 200 described above.
As shown in fig. 3, the method 300 begins at step S310. In step S310, a data access statement in the application is extracted. In the step, an extensible markup language file in application is selected through a recursive circulation mode, and further, as a software development project usually comprises a plurality of program files, the method is used for determining a data table in a database to be queried and fields in the data table, and the program usually operates the database through a persistent layer frame, the method only selects all extensible markup language files under the persistent layer frame in the software development project through the recursive circulation mode, wherein the extensible markup language files are files with an xml format suffix, and then selects a file with a root node name called a mapper, namely a mapper file, from the extensible markup language files.
Examples of XML files and mapper files are as follows: xml, wherein the suffix indicates that the file is an extensible markup language file, and a file in which the root node name (the first name before the suffix) in the extensible markup language file is Mapper is the Mapper file.
In an embodiment of the present invention, the data access statement is a Structured Query Language (SQL) statement, and the data access statement is adapted to be executed in an application to access a database in a data storage device 110 coupled to the application. Wherein the database comprises one or more interrelated data tables, each data table comprises one or more fields, and one or more fields are set as index fields. However, the persistent layer framework is a framework for operating the database, and in one embodiment of the present invention, the database is a MYSQL relational database, and the persistent layer framework is a mybits persistent layer framework.
The data access statement extracted in step S310 includes the name of the data table of the database to be accessed and the field in the data table to be accessed, and it can be seen that the accuracy of index check can be ensured only if the extracted data access statement includes all the fields in the data table to be accessed, that is, only if the extracted data access statement includes all the condition fields. .
In order to ensure that the condition field is not omitted when the data access statement is extracted, in an embodiment of the present invention, the content of the specific tag is read from the mapper file, and the tag may be all tags in the program that contain the data access statement, or may be a part of tags in the program that contain the data access statement, for example, the specific tag may be one or more of a query (select) tag, an update (update) tag, and a delete (delete) tag. After the content of the specific tag is read from the mapper file, setting the return value of the sub-tag (branch of the specific tag) in the content of the specific tag as true, and then obtaining the corresponding data access statement from all the sub-tags with the return values of true in the content of the specific tag, wherein the sub-tags comprise: if sub-tag and while sub-tag.
Before the return value of the sub-tag in the content of the specific tag is made to be true, only one branch appears in the data access statement due to the resolution of the sub-tag if id 1else id 2, but not all branches appear in the data access statement, so that the condition field extraction in the data access statement is incomplete, but when the return value of the sub-tag in the content of all tags is changed to be true, multiple branches appear in the data access statement, so that all condition fields in the data access statement are extracted, so that the condition fields cannot be omitted, and the integrity of the condition fields is ensured, and the accuracy of index checking is ensured. Of course, other methods of extracting all of the condition fields in the data access statement are within the scope of the present invention.
In one embodiment of the present invention, the contents of the specific tag of query (select), update (update) and delete (delete) are read from the mapper file by the getBoundSql method of the mybits persistent layer framework, however, the present invention is not limited to the above method for reading the contents of the specific tag, and all methods for reading the contents of the tag from the mapper file are within the protection scope of the present invention.
After obtaining the data access statement containing all the condition fields, step S320 next extracts the data tables and the condition fields in the database to be accessed from the data access statement. The data table mentioned here is a data table in a database to be accessed in a program, and the condition field is a field in all data tables corresponding to the condition statement in the data access statement and needing to be operated.
Next, a detailed description will be given of the implementation method of step S320. In an embodiment of the present invention, fig. 4 is a flowchart of a method 400 for extracting a data table and a condition field in a database to be accessed from data access statements, WHERE the method starts in step S410, and analyzes all the obtained data access statements to obtain a WHERE condition, an association condition, and a name of the data table to be queried. In an embodiment of the present invention, a database connection pool is used to analyze a canonical data access statement to obtain a WHERE condition, an association condition, and a data table name to be queried, WHERE the database connection pool is responsible for allocating, managing, and releasing database connections. Further, step S420 determines the data table in the database to be accessed by the data table name in the database to be accessed, and step S430 determines all the condition fields by the WHERE condition and the associated condition.
After determining the data table and all the condition fields, step S330 next queries the index field list corresponding to the data table from the database of the data storage device 110. An example of a MYSQL-based statement querying a list of index fields corresponding to a data table from a MYSQL relational database of the data storage device 110 is given below:
Figure BDA0002577691070000101
in this example, the indexes of all tables in the MYSQL relational database are queried, and the query results are sorted as follows: the database name is dbName, the data table name is tableName, whether the data table name is unique as nonUnique, the index name is indexName, whether non-null is allowed as nullAble, and the index type is indexType.
Finally, step S340 determines whether the queried index field list includes all condition fields, and if the index field list does not include one or more condition fields, a prompt is sent to the developer, so that the developer sets, as an index field, an unadditized index field corresponding to a condition field in a data table of the MYSQL relational database of the data storage device 110, and if the index field list includes all condition fields, no prompt is sent to the developer.
Based on the above scheme, the method for checking the index provided by the invention takes the condition field actually used in the program as the checking condition, compares the condition field with the index actually added to the field in the data table of the database, and accords with the actual situation.
Therefore, the method for automatically checking the index has high execution efficiency, is suitable for any scene for judging whether the field of the data table in the database is added with the index, and can avoid the situation that the field index of the data table in the database is easily forgotten to be added by means of memory and experience of people, thereby improving the execution efficiency of the program and realizing the expected performance of the program.
A8 the method of A7, wherein the data access statement is parsed by a database connection pool.
A9 the method of A8, wherein the database connection pool is a Druid connection pool.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to perform the method of checking an index of the present invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer-readable media includes both computer storage media and communication media. Computer storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of computer readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
Additionally, some of the embodiments are described herein as a method or combination of method elements that can be implemented by a processor of a computer system or by other means of performing the described functions. A processor with the necessary instructions for carrying out the method or the method elements thus forms a device for carrying out the method or the method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the means for performing the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

Claims (10)

1. A method of checking an index, performed in a computing device, the method comprising:
extracting a data access statement in an application, the data access statement being adapted to be executed in the application to access a database in a data storage device coupled to the application, the database comprising one or more data tables, each data table comprising one or more fields, wherein one or more fields are index fields;
extracting a data table and a condition field in a database to be accessed from the data access statement;
querying an index field list corresponding to the data table from the data storage device;
judging whether the inquired index field list comprises the condition field or not, if not, sending a prompt so as to set a field corresponding to the condition field in a data table of a database of the data storage device as an index field;
wherein, the extracting the data access statement in the application comprises:
extracting a mapper file from the application;
extracting the data access statement from the mapper file;
wherein extracting the data access statement from the mapper file comprises:
reading the contents of a particular tag from the mapper file;
setting a return value of a sub-tag in the content of the specific tag to true, wherein the sub-tag is a branch of the content of the specific tag;
and acquiring data access statements corresponding to all sub-tags with the return values of true in the content of the specific tag.
2. The method of claim 1, the extracting a mapper file from the application, comprising:
selecting all extensible markup language files in the application in a recursive circulation mode;
selecting a file with a root node name as a mapper from the extensible markup language file.
3. The method of claim 1, wherein data access statements corresponding to all sub-tags with a return value of true in the content of the specific tag are obtained through a persistent layer framework.
4. The method of claim 1 or 3, wherein the sub-tag comprises: an if sub-tag and a while sub-tag, the particular tag comprising: one or more of query tags, update tags, and delete tags.
5. The method of claim 1, wherein said extracting data tables and condition fields in a database to be accessed from said data access statement comprises:
analyzing the data access statement to obtain a WHERE condition, an association condition and a data table name required to be inquired;
determining the data table in the database to be accessed through the data table name in the database to be accessed; and
determining the condition field by the WHERE condition and the association condition.
6. The method of claim 5, wherein the data access statement is parsed by a database connection pool.
7. The method of claim 6, wherein the database connection pool is a Druid connection pool.
8. An apparatus to examine an index, executed in a computing device, the apparatus comprising:
an extraction unit for extracting a data access statement in an application, the data access statement being adapted to be executed in the application in order to access a database in a data storage device coupled to the application, the database comprising one or more data tables, each data table comprising one or more fields, wherein one or more fields are index fields; and the data access statement is used for extracting a data table and a condition field in a database to be accessed from the data access statement, wherein the extraction of the data access statement in the application comprises the following steps: extracting a mapper file from the application, the data access statement from the mapper file, wherein extracting the data access statement from the mapper file comprises: reading the content of a specific label from the mapper file, setting the return value of the sub-label in the content of the specific label to be true, wherein the sub-label is a branch of the content of the specific label, and acquiring data access statements corresponding to all sub-labels with the return values of true in the content of the specific label;
the query unit is used for querying the index field list corresponding to the data table from the data storage equipment;
and the judging unit is used for judging whether the inquired index field list comprises the condition field or not, and if the condition field is not included, sending a prompt so as to set the field corresponding to the condition field in the data table of the database of the data storage device as the index field.
9. A computing device, comprising:
at least one processor; and
a memory storing program instructions configured for execution by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-7.
10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-7.
CN202010658713.2A 2020-07-09 2020-07-09 Index checking method and device and computing equipment Active CN111831659B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010658713.2A CN111831659B (en) 2020-07-09 2020-07-09 Index checking method and device and computing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010658713.2A CN111831659B (en) 2020-07-09 2020-07-09 Index checking method and device and computing equipment

Publications (2)

Publication Number Publication Date
CN111831659A CN111831659A (en) 2020-10-27
CN111831659B true CN111831659B (en) 2022-09-06

Family

ID=72900350

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010658713.2A Active CN111831659B (en) 2020-07-09 2020-07-09 Index checking method and device and computing equipment

Country Status (1)

Country Link
CN (1) CN111831659B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559327B (en) * 2020-12-02 2022-09-06 天津车之家数据信息技术有限公司 Test case generation method and device and computing equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008109776A2 (en) * 2007-03-06 2008-09-12 Nitrosecurity, Inc. Databases and database indexes
CN103164455A (en) * 2011-12-15 2013-06-19 百度在线网络技术(北京)有限公司 Optimization method and optimization device of data base
CN105701098A (en) * 2014-11-25 2016-06-22 国际商业机器公司 Method and apparatus for generating index for table in database
CN109145004A (en) * 2018-08-29 2019-01-04 智慧互通科技有限公司 A kind of method and device creating database index
CN110858202A (en) * 2018-08-21 2020-03-03 北京京东尚科信息技术有限公司 Method and device for generating where clause in database query statement
CN110955662A (en) * 2019-11-29 2020-04-03 车智互联(北京)科技有限公司 Method, computing device and storage medium for maintaining data table association relation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008109776A2 (en) * 2007-03-06 2008-09-12 Nitrosecurity, Inc. Databases and database indexes
CN103164455A (en) * 2011-12-15 2013-06-19 百度在线网络技术(北京)有限公司 Optimization method and optimization device of data base
CN105701098A (en) * 2014-11-25 2016-06-22 国际商业机器公司 Method and apparatus for generating index for table in database
CN110858202A (en) * 2018-08-21 2020-03-03 北京京东尚科信息技术有限公司 Method and device for generating where clause in database query statement
CN109145004A (en) * 2018-08-29 2019-01-04 智慧互通科技有限公司 A kind of method and device creating database index
CN110955662A (en) * 2019-11-29 2020-04-03 车智互联(北京)科技有限公司 Method, computing device and storage medium for maintaining data table association relation

Also Published As

Publication number Publication date
CN111831659A (en) 2020-10-27

Similar Documents

Publication Publication Date Title
JP5306359B2 (en) Method and system for associating data records in multiple languages
US7499915B2 (en) Index for accessing XML data
CN108509547B (en) Information management method, information management system and electronic equipment
CN110275864B (en) Index establishing method, data query method and computing device
US20070198566A1 (en) Method and apparatus for efficient storage of hierarchical signal names
CN109933571B (en) Database design document generation method, device and computer readable storage medium
US8209361B2 (en) Techniques for efficient and scalable processing of complex sets of XML schemas
US20180181646A1 (en) System and method for determining identity relationships among enterprise data entities
CN108334609B (en) Method, device, equipment and storage medium for realizing JSON format data access in Oracle
CN111708805A (en) Data query method and device, electronic equipment and storage medium
US10997131B1 (en) Using a member attribute to perform a database operation on a computing device
US20210382902A1 (en) Data storage method and data query method
CN112328548A (en) File retrieval method and computing device
US9734178B2 (en) Searching entity-key associations using in-memory objects
US9053207B2 (en) Adaptive query expression builder for an on-demand data service
CN112035480A (en) Data table management method, device, equipment and storage medium
US7882089B1 (en) Caching database information
CN109815240A (en) For managing method, apparatus, equipment and the storage medium of index
CN111831659B (en) Index checking method and device and computing equipment
CN110955662A (en) Method, computing device and storage medium for maintaining data table association relation
CN109408539B (en) Data operation method, device, server and storage medium
CN113535642A (en) File searching method and computing device
CN112579635A (en) SQL statement optimization method and device, electronic equipment and storage medium
CN113779068B (en) Data query method, device, equipment and storage medium
WO2014186130A1 (en) Method and system to determine part-of-speech

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant