Get the App
SLTechnology News&Howtos  ›  Database  › 

Index of SQL

Shulou Source: shulou.com Published: 2022-06-01 07:31:25 10月03日 Update

Create a table:

QString querystr; querystr= "create table if not exists terminaldata (TerminalID varchar (20),"; QMap::iterator itC; / / for (itC = Map_variable_info.begin (); itC! = Map_variable_info.end (); + + itC) {querystr+=itC.value () + "varchar (20),";} querystr= querystr+ "SendServer1Flag int,SendServer2Flag int,CreateTime varchar (20)"; res = query.exec (querystr)

Create an index on the TerminalID column in the table:

Res = query.exec ("create index if not exists TerminalID_index on terminaldata (TerminalID)")

The role of an index: whenever a column is indexed, the query speed of that column will be faster when it is queried later. An index created on a column cannot be seen on a column, and when querying this column, it is still queried according to the column name, but because the column has been indexed, it is faster to query the column.

Tags: Index query speed function just time or build one Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MariaDB Shulou Information Huawei Microsoft