Skip to content

enhance range calculation upon user variables #8733

@laizhebujum

Description

@laizhebujum

Description

Compare two sqls
1、
SET @execDate = DATE_FORMAT(NOW(),'%Y-%m-%d');
SET @start_time = DATE_ADD(NOW(), INTERVAL -1 DAY);
SET @end_time = @execDate;
desc SELECT count(*) FROM GameActiveLogDB.wendao_active_log WHERE active_time >= @Start_time AND active_time < @End_time;

image

2、desc SELECT count(*) FROM GameActiveLogDB.wendao_active_log WHERE active_time >= DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY),'%Y-%m-%d') AND active_time < DATE_FORMAT(NOW(),'%Y-%m-%d');
image

Score

900

SIG slack channel(must):

Contact us in channel #sig-planner of TiDB Community

Mentor(must)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions