0

I recently found the select syntax in TDengine SQL is slightly different from mysql due to stable. But I cannot give a reasonable explanation. Let me show the emample: Here is the stable structure:

describe mystable;
             Field              |         Type         |   Length    |   Note   |
=================================================================================
 ts                             | TIMESTAMP            |           8 |          |
 value                          | DOUBLE               |           8 |          |
 tag1                           | NCHAR                |          16 | TAG      |
 tag2                           | NCHAR                |          43 | TAG      |
 tag3                           | NCHAR                |          29 | TAG      |
 tag4                           | NCHAR                |          10 | TAG      |
 tag5                           | NCHAR                |           2 | TAG      |

When I execute:

select count(*) from mystable
       count(*)        |
========================
                270419 |

And count on a colume, the result should be the same:

select count(value) from mystable
       count(value)      |
========================
                270419   |

However, When count on a tag, the results is different:

select count(tag1) from mystable
       count(tag1)      |
========================
                13      |

So what does select(tag_name) actually means in TDengine sql?

naissance
  • 36
  • 12

2 Answers2

0

After get the response of professional personnel of R&D. The select(tag_name) means number of tables belong to this stable with specified tag, we can print it out by using sql:

select tbname, tag1 from stable;
naissance
  • 36
  • 12
0

From my understanding, select count(*) or count(column) returns the number of records of each child table which belongs to the same super table. But tags are different, although tags can be used to filter records for each child table, but does not attach to each record, so select count(tag) returns number of distinct tags for stable, but not number of total records.

GeorgeWill93
  • 167
  • 5