Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

faq: add a summary page for all TiDB FAQs #10217

Merged
merged 16 commits into from
Aug 25, 2022
Prev Previous commit
Next Next commit
address comments
  • Loading branch information
TomShawn committed Aug 22, 2022
commit a8bf9a1a11b09e70c8fabbe7da27e023af157a88
15 changes: 8 additions & 7 deletions faq/sql-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ This document summarizes the FAQs related to SQL operations in TiDB.

## Does TiDB support secondary key?

Yes. If a column in TiDB meets all of the following conditions, it can work as a secondary key:

- Not the primary key column
- Have the [`NOT NULL` constraint](/constraints.md#not-null)
- Have a [secondary index](/develop/dev-guide-create-secondary-indexes.md)
Yes. You can have the [`NOT NULL` constraint](/constraints.md#not-null) on a non-primary key column with a unique [secondary index](/develop/dev-guide-create-secondary-indexes.md). In this case, the column works as a secondary key.

## How does TiDB perform when executing DDL operations on a large table?

DDL operations of TiDB on large tables are usually not an issue. TiDB supports online DDL operations, and these DDL operations do not block DML operations.

For some DDL operations such as adding columns, deleting columns or dropping indexes, TiDB can perform these operations quickly.

For some heavy DDL operations such as adding indexes, TiDB needs to backfill data, which takes a longer time (depending on the size of the table) and consumes additional resources. The impact on online traffic is tunable. TiDB can do the backfill with multiple threads, and you can tune the number of threads.
For some heavy DDL operations such as adding indexes, TiDB needs to backfill data, which takes a longer time (depending on the size of the table) and consumes additional resources. The impact on online traffic is tunable. TiDB can do the backfill with multiple threads, and the number of threads is set by the following system variables:

- [`tidb_ddl_reorg_worker_cnt`](/system-variables.md#tidb_ddl_reorg_worker_cnt)
- [`tidb_ddl_reorg_priority`](/system-variables.md#tidb_ddl_reorg_priority)
- [`tidb_ddl_error_count_limit`](/system-variables.md#tidb_ddl_error_count_limit)
- [`tidb_ddl_reorg_batch_size`](/system-variables.md#tidb_ddl_reorg_batch_size)

## How to choose the right query plan? Do I need to use hints? Or can I use hint?

Expand Down Expand Up @@ -309,7 +310,7 @@ See [The TiDB Command Options](/command-line-flags-for-tidb-configuration.md).

### How to avoid hotspot issues and achieve load balancing? Is hot partition or range an issue in TiDB?

To learn the scenarios that cause hotspots, refer to [common hotpots](/troubleshoot-hot-spot-issues.md#common-hotspots). To resolve hotspot issues, you can use the following built-in TiDB features:
To learn the scenarios that cause hotspots, refer to [common hotpots](/troubleshoot-hot-spot-issues.md#common-hotspots). To resolve hotspot issues, you can try the following built-in TiDB features:

- Set the [`SHARD_ROW_ID_BITS`](/troubleshoot-hot-spot-issues.md#use-shard_row_id_bits-to-process-hotspots) attribute. Then row IDs are scattered and written into multiple Regions, which can alleviate the write hotspot issue.
- For hotspots brought by auto-increment primary keys, use the [`AUTO_RANDOM`](/troubleshoot-hot-spot-issues.md#handle-auto-increment-primary-key-hotspot-tables-using-auto_random) attribute.
Expand Down
5 changes: 0 additions & 5 deletions faq/tidb-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ Currently [TiDB documentation](/overview.md#tidb-introduction) is the most impor

For more information, see [TiDB Limitations](/tidb-limitations.md).

### Does TiDB support JSON or protocal buffers (protobuf)?

- TiDB supports the native JSON type and JSON functions, which is MySQL-compatible.
- Currently, TiDB does not support protocal buffers.

### Does TiDB support XA?

No. The JDBC driver of TiDB is MySQL JDBC (Connector/J). When using Atomikos, set the data source to `type="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"`. TiDB does not support the connection with MySQL JDBC XADataSource. MySQL JDBC XADataSource only works for MySQL (for example, using DML to modify the `redo` log).
Expand Down