sequelize查询没有响应

时间:2017-10-23 15:37:53

标签: mysql node.js sequelize.js

我正在对大约230万行数据运行原始续集查询。当我这样做时,我永远不会指出我在“查询后”看到的地方。我只看到“查询前”。这表明我的查询永远不会被执行。我等了很长时间(~10分钟),看看它是否被执行,即使在使用catch函数捕获错误后我也没有收到错误信息。我混淆了查询的内容。另外,我尝试在本地运行查询以查看它需要多长时间,并且执行只需要大约5-10秒。这表明我的查询不需要花费很多时间。

/*
 *  Define the Model/Table in database
 */
var TriactaCarma = sequelize.define('triacta_carma',{
    time_stamp:{
        type:Sequelize.DATE(6),
        field: 'time_stamp',
    unique: true
    },
    file_name:{
        type:Sequelize.STRING,
        field: 'file_name',
    },
    SN:{
        type:Sequelize.STRING,
        field: 'SN',
    unique:true
    },
  Ch1:{
    type:Sequelize.DOUBLE,
    field:'Ch1'
  },
  Ch2:{
    type:Sequelize.DOUBLE,
    field:'Ch2'
  },
  Ch3:{
    type:Sequelize.DOUBLE,
    field:'Ch3'
  },
  Ch4:{
    type:Sequelize.DOUBLE,
    field:'Ch4'
  },
  Ch5:{
    type:Sequelize.DOUBLE,
    field:'Ch5'
  },
  Ch6:{
    type:Sequelize.DOUBLE,
    field:'Ch6'
  },
  Ch7:{
    type:Sequelize.DOUBLE,
    field:'Ch7'
  },
  Ch8:{
    type:Sequelize.DOUBLE,
    field:'Ch8'
  },
  Ch9:{
    type:Sequelize.DOUBLE,
    field:'Ch9'
  },
  Ch10:{
    type:Sequelize.DOUBLE,
    field:'Ch10'
  },
  Ch11:{
    type:Sequelize.DOUBLE,
    field:'Ch11'
  },
  Ch12:{
    type:Sequelize.DOUBLE,
    field:'Ch12'
  },
  Ch13:{
    type:Sequelize.DOUBLE,
    field:'Ch13'
  },
  Ch14:{
    type:Sequelize.DOUBLE,
    field:'Ch14'
  },
  Ch15:{
    type:Sequelize.DOUBLE,
    field:'Ch15'
  },
  Ch16:{
    type:Sequelize.DOUBLE,
    field:'Ch16'
  },
  Ch17:{
    type:Sequelize.DOUBLE,
    field:'Ch17'
  },
  Ch18:{
    type:Sequelize.DOUBLE,
    field:'Ch18'
  },
  Ch19:{
    type:Sequelize.DOUBLE,
    field:'Ch19'
  },
  Ch20:{
    type:Sequelize.DOUBLE,
    field:'Ch20'
  }
},
{
  timestamps:false,
  freezeTableName: true
});
TriactaCarma.removeAttribute('id');

var sequelize = new Sequelize('ptls','root','ODYSSEY99GRANITE',{
  host: 'localhost',
  dialect: 'mysql',
  logging: false,
  pool: {
    max: 5,
    min: 0,
    idle: 10000
  }
});

var max_dials_row_query = sequelize.query("select * from triacta_carma where time_stamp = (select maxdate FROM (select max(time_stamp) as maxdate from triacta_carma) As A) order by SN ASC" ,{model: TriactaCarma, raw:true});
    console.log("before query");    
    max_dials_row_query.then(function(max_dials_rows){
        console.log("after query");
    });

0 个答案:

没有答案