mysql

MYSQL nested query running very slow?

ぃ、小莉子 提交于 2021-02-09 18:58:09
问题 The following query is constantly timing out, is there a less overhead way to achieve the same function ? UPDATE Invoices SET ispaid = 0 WHERE Invoice_number IN (SELECT invoice_number FROM payment_allocation WHERE transactionID=305) What I'm doing is unallocating invoices from a transaction, there can be up to 30+ records returned but it stops the database dead everytime I try to run it 回答1: USE JOIN instead of subquery it will improve the performance. Create index on Invoice_number column in

Can I execute query via sqlalchemy without transaction

非 Y 不嫁゛ 提交于 2021-02-09 18:02:49
问题 I am trying to execute a stored procedure on Mysql database with sqlalchemy. It runs fine from the shell but throws this error: OperationalError: (MySQLdb._exceptions.OperationalError) (1568, "Transaction characteristics can't be changed while a transaction is in progress") The reason as it seems is that SQLAlchemy runs query within a transaction. And the transaction within the stored procedure is conflicting with it. Below is sqlalchemy log: 2019-07-24 15:20:28,888 INFO sqlalchemy.engine

Can I execute query via sqlalchemy without transaction

别等时光非礼了梦想. 提交于 2021-02-09 18:02:25
问题 I am trying to execute a stored procedure on Mysql database with sqlalchemy. It runs fine from the shell but throws this error: OperationalError: (MySQLdb._exceptions.OperationalError) (1568, "Transaction characteristics can't be changed while a transaction is in progress") The reason as it seems is that SQLAlchemy runs query within a transaction. And the transaction within the stored procedure is conflicting with it. Below is sqlalchemy log: 2019-07-24 15:20:28,888 INFO sqlalchemy.engine

Can I execute query via sqlalchemy without transaction

和自甴很熟 提交于 2021-02-09 18:01:22
问题 I am trying to execute a stored procedure on Mysql database with sqlalchemy. It runs fine from the shell but throws this error: OperationalError: (MySQLdb._exceptions.OperationalError) (1568, "Transaction characteristics can't be changed while a transaction is in progress") The reason as it seems is that SQLAlchemy runs query within a transaction. And the transaction within the stored procedure is conflicting with it. Below is sqlalchemy log: 2019-07-24 15:20:28,888 INFO sqlalchemy.engine

skywalking安装运行(docker)

烂漫一生 提交于 2021-02-09 16:08:38
https://github.com/apache/skywalking-docker/tree/master/6/6.5 https://hub.docker.com/r/apache/skywalking-oap-server https://hub.docker.com/r/apache/skywalking-ui mkdir /opt/skywalking-oap-server wget -P /opt/skywalking-oap-server https://github.com/apache/skywalking-docker/blob/master/6/6.5/oap/docker-entrypoint.sh wget -P /opt/skywalking-oap-server https://github.com/apache/skywalking-docker/blob/master/6/6.5/oap/log4j2.xml vim /opt/skywalking-oap-server/Dockerfile FROM apache/skywalking-oap-server:6.5.0 EXPOSE 12800 11800 1234 vim /opt/skywalking-oap-server/docker-compose.yml es: 非docker版

PHP/MySQL run query on button press/click

落花浮王杯 提交于 2021-02-09 15:54:43
问题 Was wondering if it's possible to run/re-run a mysql query when a button/link is pressed/clicked? Basically, I run a query that limits the results to the first 7, with a button below the results to show more results. When the button is clicked/pressed, I need to re-run the query and set the limit to, say 20. Any help/advice on how to do this would be greatly appreciated. Thanks in advance, S. 回答1: The code to run the query and produce the results is on the server and the button is on the

PHP/MySQL run query on button press/click

天大地大妈咪最大 提交于 2021-02-09 15:54:26
问题 Was wondering if it's possible to run/re-run a mysql query when a button/link is pressed/clicked? Basically, I run a query that limits the results to the first 7, with a button below the results to show more results. When the button is clicked/pressed, I need to re-run the query and set the limit to, say 20. Any help/advice on how to do this would be greatly appreciated. Thanks in advance, S. 回答1: The code to run the query and produce the results is on the server and the button is on the

Entity framework database provider compatibility error

社会主义新天地 提交于 2021-02-09 14:00:28
问题 I am trying to use Entity framework to setup an ADO.net model using MYSQL DB following the instructions @https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html,I installed the connector and stuck at the below error,I shared my App.config details aswell,can anyone help me on how to fix this error? App.config <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com

MySQL函数大全及用法

僤鯓⒐⒋嵵緔 提交于 2021-02-09 13:54:44
1、字符串函数 ascii(str) 返回字符串str的第一个字符的ascii值(str是空串时返回0) mysql> select ascii('2');   -> 50 mysql> select ascii(2);   -> 50 mysql> select ascii('dete');   -> 100 ord(str) 如果字符串str句首是单字节返回与ascii()函数返回的相同值。 如果是一个多字节字符,以格式返回((first byte ascii code)*256+(second byte ascii code))[*256+third byte asciicode...] mysql> select ord('2');   -> 50 conv(n,from_base,to_base) 对数字n进制转换,并转换为字串返回(任何参数为null时返回null,进制范围为2-36进制,当to_base是负数时n作为有符号数否则作无符号数,conv以64位点精度工作) mysql> select conv("a",16,2);   -> '1010' mysql> select conv("6e",18,8);   -> '172' mysql> select conv(-17,10,-18);   -> '-h' mysql> select conv(10+"10"

mysql查询今天、昨天、7天、近30天、本月、上一月 数据

懵懂的女人 提交于 2021-02-09 13:34:39
今天 select * from 表名 where to_days(时间字段名) = to_days(now()); 昨天 SELECT * FROM 表名 WHERE TO_DAYS( NOW( ) ) - TO_DAYS( 时间字段名) <= 1 7天 SELECT * FROM 表名 where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(时间字段名) 近30天 SELECT * FROM 表名 where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(时间字段名) 本月 SELECT * FROM 表名 WHERE DATE_FORMAT( 时间字段名, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' ) 上一月 SELECT * FROM 表名 WHERE PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( 时间字段名, '%Y%m' ) ) =1 #查询本季度数据 select * from `ht_invoice_information` where QUARTER(create_date)= QUARTER(now()) #查询上季度数据 select * from `ht