explain

Comparison of Explain Statement Output on Amazon Redshift

风格不统一 提交于 2019-12-24 18:13:31
问题 I have written a very complicated query in Amazon Redshift which comprises of 3-4 temporary tables along with sub-queries.Since, Query is slow in execution, I tried to replace it with another query, which uses derived tables instead of temporary tables. I just want to ask, Is there any way to compare the " Explain " Output for both the queries, so that we can conclude which query is working better in performance(both space and time ). Also, how much helpful is replacing temporary tables with

MySQL not picking correct row count from index

寵の児 提交于 2019-12-24 07:09:07
问题 I have a following table CREATE TABLE `test_series_analysis_data` ( `email` varchar(255) NOT NULL, `mappingId` int(11) NOT NULL, `packageId` varchar(255) NOT NULL, `sectionName` varchar(255) NOT NULL, `createdAt` datetime(3) DEFAULT NULL, `marksObtained` float NOT NULL, `updatedAt` datetime DEFAULT NULL, `testMetaData` longtext, PRIMARY KEY (`email`,`mappingId`,`packageId`,`sectionName`), KEY `rank_index` (`mappingId`,`packageId`,`sectionName`,`marksObtained`), KEY `mapping_package` (

Mysql optimization based on explain

被刻印的时光 ゝ 提交于 2019-12-24 00:44:50
问题 I have the following query that takes a really long time to execute. I need to speed it up, but I'm at a lost as to what technique to use. This is the query: SELECT `User`.`id`, `User`.`username`, `User`.`password`, `User`.`role`, `User`.`created`, `User`.`modified`, `User`.`email`, `User`.`other_user_id`, `User`.`first_name`, `User`.`last_name`, `User`.`place_id`, `Resume`.`id`, `Resume`.`user_id`, `Resume`.`other_resume_id`, `Resume`.`other_user_id`, `Resume`.`file_extension`, `Resume`.

MySql refuses to use index

余生颓废 提交于 2019-12-23 20:57:56
问题 I'm new to query optimizations so I accept I don't understand everything yet but I do not understand why even this simple query isn't optimized as expected. My table: +------------------+-----------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+-----------+------+-----+-------------------+----------------+ | tasktransitionid | int(11) | NO | PRI | NULL | auto_increment | | taskid | int(11) | NO | MUL | NULL | | |

SELECT statement not using possible_keys

落花浮王杯 提交于 2019-12-23 07:27:11
问题 I have a table from a legacy system which does not have a primary key. It records transactional data for issuing materials in a factory. For simplicities sake, lets say each row contains job_number, part_number, quantity & date_issued. I added an index to the date issued column. When I run an EXPLAIN SELECT * FROM issued_parts WHERE date_issued > '20100101', it shows this: +----+-------------+----------------+------+-------------------+------+---------+------+---------+-------------+ | id |

Clarification of join order for creation of temporary tables

北战南征 提交于 2019-12-22 11:28:48
问题 I have a large query in mysql that involves joining multiple tables together. It's too slow, so I've done "explain" and see that it's creating a temporary table, which I suspect of taking most of the execution time. I found some related information: The mysql docs describe conditions when a temporary table might be created. ("The server creates temporary tables under conditions such as these ..." [Emphasis added]) This related SO question Using index, using temporary, using filesort - how to

How to make Sqlite use an index for ordering on multiple columns in the case of multiple selection from the same table?

邮差的信 提交于 2019-12-19 12:06:08
问题 I have a table with a few hundred thousand lines. (It’s a precomputed table expressing the relation between lemmas of words and other big tables.) I need to do multiple selections to find a combination of different entries, i.e. I have to use “AS” to do select … from ltc as l0, ltc as l1, ltc as l2 … order by ... The speed of the query depends on the sorting: Without sorting, it’s a few milliseconds, with sorting, it can take a few minutes. This is due, as far as I can tell, to the temporary

How to make Sqlite use an index for ordering on multiple columns in the case of multiple selection from the same table?

江枫思渺然 提交于 2019-12-19 12:06:01
问题 I have a table with a few hundred thousand lines. (It’s a precomputed table expressing the relation between lemmas of words and other big tables.) I need to do multiple selections to find a combination of different entries, i.e. I have to use “AS” to do select … from ltc as l0, ltc as l1, ltc as l2 … order by ... The speed of the query depends on the sorting: Without sorting, it’s a few milliseconds, with sorting, it can take a few minutes. This is due, as far as I can tell, to the temporary

Reuse computed select value

混江龙づ霸主 提交于 2019-12-19 08:54:34
问题 I'm trying to use ST_SnapToGrid and then GROUP BY the grid cells (x, y). Here is what I did first: SELECT COUNT(*) AS n, ST_X(ST_SnapToGrid(geom, 50)) AS x, ST_Y(ST_SnapToGrid(geom, 50)) AS y FROM points GROUP BY x, y I don't want to recompute ST_SnapToGrid for both x and y . So I changed it to use a sub-query: SELECT COUNT(*) AS n, ST_X(geom) AS x, ST_Y(geom) AS y FROM ( SELECT ST_SnapToGrid(geom, 50) AS geom FROM points ) AS tmp GROUP BY x, y But when I run EXPLAIN , both of these queries

How do I use DB2 Explain?

让人想犯罪 __ 提交于 2019-12-17 18:17:27
问题 How do I use DB2's Explain function? -- both to run it, and to use it to optimize queries. Is there a better tool available for DB2? I've built queries before, but the only way I've had to tell how long they'd take is to run them and time them -- which is hardly ideal. Edit: The answer for me turned out to be "You can't. You don't have and cannot get the access." Don't you love bureaucracy? 回答1: What you're looking for is covered by two DB2 utilities: The explain utility, which shows the