In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly talks about "what is the difference between count (*), count (1) and count (listing)". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what is the difference between count (*), count (1) and count (listing)"!
1. Execution effect:
L count (*) includes all columns, which are equivalent to the number of rows. When counting the results, the column value of NULL is not ignored.
L count (1) includes ignoring all columns, using 1 for lines of code, and not ignoring that the column value is NULL when counting the results.
L count (column name) only includes the column name. When counting the results, it ignores the count when the column value is empty (the empty value here is not just an empty string or 0, but represents null), that is, when a field value is NULL, it is not counted.
2. Executive efficiency:
L column name is primary key, count (column name) will be faster than count (1)
L column name is not primary key, count (1) will be faster than count (column name)
If the table has multiple columns and no primary key, then count (1) is more efficient than count (*).
If there is a primary key, then the execution efficiency of select count (primary key) is the best.
If the table has only one field, select count (*) is the best.
3. Case analysis:
At this point, I believe you have a deeper understanding of what is the difference between count (*), count (1) and count (listing). You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.