Help Center/ AI DataLake/ Flink reference/ Enhanced Flink Features/ Optimizing the Performance of the SPLIT_INDEX Function in Flink SQL
Updated on 2026-11-06 GMT+08:00

Optimizing the Performance of the SPLIT_INDEX Function in Flink SQL

Scenario

When the built-in SPLIT_INDEX function of FlinkSQL is used to parse multiple fields of a string, enabling the SPLIT_INDEX function performance optimization allows the parsing result of the last split to be reused when parsing multiple fields of the same string, thereby improving computing performance.

Usage

You can use either of the following methods to set table.optimizing.split-index-optimization to true to enable the SPLIT_INDEX function performance optimization:

  • Method 1: When configuring a Flink job, add this custom parameter to the flink_config parameter of the job.
  • Method 2: Add this custom parameter to the Flink parameters of the endpoint.

SQL Example

CREATE TABLE datagen (
  auction BIGINT,
  bidder BIGINT,
  price BIGINT,
  channel VARCHAR,
  url VARCHAR
)
WITH
  ('connector' = 'datagen');

CREATE TABLE blackhole (
  auction BIGINT,
  bidder BIGINT,
  price BIGINT,
  channel VARCHAR,
  dir1 VARCHAR,
  dir2 VARCHAR,
  dir3 VARCHAR
)
WITH
  ('connector' = 'blackhole');

INSERT INTO
  blackhole
SELECT
  auction,
  bidder,
  price,
  channel,
  SPLIT_INDEX (url, '/', 3) as dir1,
  SPLIT_INDEX (url, '/', 4) as dir2,
  SPLIT_INDEX (url, '/', 5) as dir3
FROM
  datagen;