• Daniel Black's avatar
    MDEV-8981: Analyze stmt - cycles can overflow · 0b8144a4
    Daniel Black authored
    A 64bit counter can overflow within the time of a query
    so lets take it that the measurement is the small value
    rather than an order 1e12 millisecond query.
    
    tested with:
    
    int main()
    {
      ulonglong start = ULONGLONG_MAX - 30;
      ulonglong end = 600;
      ulonglong cycles = 10000;
    
      cycles += end - start;
      if (unlikely(end < start))
         cycles += ULONGLONG_MAX;
    
      printf("cycles %llu\n", cycles);
    }
    0b8144a4
sql_analyze_stmt.h 12.2 KB