database-tuning

How to view history of queries (all OR over a long period) performed on database which is hosted on Azure?

独自空忆成欢 提交于 2020-12-29 00:48:07
问题 For a database hosted on Azure, i can view the recent history of the queries performed on it. This is through the Azure portal > Database > Manage > Administration > Query Performance . Unfortunately, the history found there, only covers a small time frame (few minutes). I intend to create non-clustered indexes on my database and for that, need to get a log of the real queries run on the data on a typical day, as opposed to the past few minutes. Currently, i have to keep refreshing the page

How to view history of queries (all OR over a long period) performed on database which is hosted on Azure?

白昼怎懂夜的黑 提交于 2020-12-29 00:44:42
问题 For a database hosted on Azure, i can view the recent history of the queries performed on it. This is through the Azure portal > Database > Manage > Administration > Query Performance . Unfortunately, the history found there, only covers a small time frame (few minutes). I intend to create non-clustered indexes on my database and for that, need to get a log of the real queries run on the data on a typical day, as opposed to the past few minutes. Currently, i have to keep refreshing the page

How to view history of queries (all OR over a long period) performed on database which is hosted on Azure?

*爱你&永不变心* 提交于 2020-12-29 00:43:56
问题 For a database hosted on Azure, i can view the recent history of the queries performed on it. This is through the Azure portal > Database > Manage > Administration > Query Performance . Unfortunately, the history found there, only covers a small time frame (few minutes). I intend to create non-clustered indexes on my database and for that, need to get a log of the real queries run on the data on a typical day, as opposed to the past few minutes. Currently, i have to keep refreshing the page

Why this mysql query (with is null check) is so slower than this other one?

泪湿孤枕 提交于 2020-01-23 19:28:15
问题 I getting in doubt with "IS NULL" MySQL check. I have this 2 queries. The first one runs in about 300 seconds. The second one run less then 1 second! Slow query: SELECT count(distinct(u.id)) FROM ips_usuario AS u JOIN ips_fatura AS f ON ((u.id = f.ips_usuario_id) OR (u.ips_usuario_id_titular IS NOT NULL AND u.ips_usuario_id_titular = f.ips_usuario_id)); Fast query: SELECT count(distinct(u.id)) FROM ips_usuario AS u JOIN ips_fatura AS f ON ((u.id = f.ips_usuario_id) OR (u.ips_usuario_id

How to profile MySQL

谁说我不能喝 提交于 2020-01-09 07:10:19
问题 How do I profile a MySQL database. I want to see all the SQL being run against a database. I know you can do this: set profiling=1; Run your slow query (eg SELECT * FROM messages WHERE fromaddress='xxx'; SHOW PROFILES; But this seem to only apply to stuff run on the command line, I want to see the results from running a website. 回答1: You want the query log - but obviously doing this on a heavy production server could be... unwise. 回答2: That worked for me on Ubuntu. Find and open your MySQL

How to profile MySQL

南笙酒味 提交于 2020-01-09 07:06:08
问题 How do I profile a MySQL database. I want to see all the SQL being run against a database. I know you can do this: set profiling=1; Run your slow query (eg SELECT * FROM messages WHERE fromaddress='xxx'; SHOW PROFILES; But this seem to only apply to stuff run on the command line, I want to see the results from running a website. 回答1: You want the query log - but obviously doing this on a heavy production server could be... unwise. 回答2: That worked for me on Ubuntu. Find and open your MySQL

Analyze Table Syntax Error

余生颓废 提交于 2019-12-24 23:19:51
问题 The following sql statement raises a syntax error: analyze table my_table sample_size 0; This is the raised error: Syntax error in SQL statement "ANALYZE TABLE MY_TABLE SAMPLE_SIZE[*] 0 "; expected "integer"; The official documentation gives the following: ANALYZE [TABLE tableName] [SAMPLE_SIZE rowCountInt] (...) The value 0 means all rows are read. How to workaround this problem? H2 1.4.196 回答1: The error results from a bug in the h2 database parsing code. A fix has been sent. I don't know

Query is extremely slow due to Lazy Index Spool

无人久伴 提交于 2019-12-13 02:59:49
问题 On a powerful machine the SQL Server query is running too slowly. In the execution plan I can see that most of the time spent goes to a "Lazy Index Spooling" process. In the query some aggregate functions are being used for calculation of values. How can I speed-up the query (machine resources are enough)? Thanks in advance. 来源: https://stackoverflow.com/questions/26314632/query-is-extremely-slow-due-to-lazy-index-spool

Why does Postgres do a sequential scan where the index would return < 1% of the data?

 ̄綄美尐妖づ 提交于 2019-12-11 08:57:16
问题 I have 19 years of Oracle and MySQL experience (DBA and dev) and I am new to Postgres, so I may be missing something obvious. But I can not get this query to do what I want. NOTE: This query is running on an EngineYard Postgres instance. I am not immediately aware of the parameters it has set up. Also, columns applicable_type and status in the items table are of extension type citext. The following query can take in excess of 60 seconds to return rows: SELECT items.item_id, CASE when items

Optimizing sequential scan in PostgreSQL

﹥>﹥吖頭↗ 提交于 2019-12-10 23:51:50
问题 PostgreSQL 9.4 In the article about hardware optimization for PostgreSQL server was shown that too much moving disk head may cause performance bottleneck. As far as I got, for the sequential scan, it'd be much faster if the cylinders with blocks of the same table are located as close as possible. So, if we're inserting data into a table, the data will be placed in "sequential order" on a disk-storage, therefore reducing the disk head moving overhead. But I presume that such location may be