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

[Improve](count on index) improve performance for count on index other than match #24678

Merged
merged 2 commits into from Sep 21, 2023

Conversation

airborne12
Copy link
Contributor

@airborne12 airborne12 commented Sep 20, 2023

Proposed changes

Issue Number: close #xxx

Related PR: #23276

Test with httplogs dataset, schema as following, we use inverted index for size column:

CREATE TABLE `httplogs` (
  `@timestamp` int(11) NULL,
  `clientip` varchar(20) NULL,
  `request` text NULL,
  `status` int(11) NULL,
  `size` int(11) NULL,
  INDEX size_idx (`size`) USING INVERTED COMMENT ''
) ENGINE=OLAP
DUPLICATE KEY(`@timestamp`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`@timestamp`) BUCKETS 24
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"compression" = "ZSTD",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

Total lines for httplogs:

mysql> select COUNT() from httplogs;
+------------+
| count(*)   |
+------------+
| 1474712832 |
+------------+
1 row in set (0.18 sec)

before optimization:

mysql> select COUNT(*) from httplogs where size > 20000;
+----------+
| count(*) |
+----------+
| 50533266 |
+----------+
1 row in set (1.22 sec)

mysql> select COUNT(*) from httplogs where size > 20000;
+----------+
| count(*) |
+----------+
| 50533266 |
+----------+
1 row in set (0.45 sec)

after optimization:

mysql> select COUNT(*) from httplogs where size > 20000;                                                                                                               +----------+ 
| count(*) |                                                                                                                                                              
+----------+                                                                                                                                                             
| 50533266 |                                                                                                                                                              
+----------+
1 row in set (0.64 sec)

mysql> select COUNT(*) from httplogs where size > 20000;
+----------+
| count(*) |
+----------+
| 50533266 |
+----------+
1 row in set (0.20 sec)

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@airborne12
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.95 seconds
stream load tsv: 596 seconds loaded 74807831229 Bytes, about 119 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 28.9 seconds inserted 10000000 Rows, about 346K ops/s
storage size: 17162432122 Bytes

@airborne12
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.76 seconds
stream load tsv: 604 seconds loaded 74807831229 Bytes, about 118 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 29.1 seconds inserted 10000000 Rows, about 343K ops/s
storage size: 17162462872 Bytes

Copy link
Contributor

@xiaokang xiaokang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 21, 2023
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

Copy link
Contributor

@starocean999 starocean999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiaokang xiaokang merged commit 232226e into apache:master Sep 21, 2023
22 of 24 checks passed
xiaokang pushed a commit that referenced this pull request Sep 21, 2023
@xiaokang xiaokang mentioned this pull request Sep 30, 2023
@xiaokang xiaokang mentioned this pull request Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/2.0.2-merged reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants