query-performance

Query cost: Global Temporary Tables vs. Collections (Virtual Arrays)

最后都变了- 提交于 2020-07-16 07:01:36
问题 I have a query whose results are stored in a GTT (Global Temporary Table) and in a Collection. Selecting the data from the GTT again, I get a very small cost: 103. SELECT ... FROM my_table_gtt JOIN table2 ... JOIN table3 ... But when switching this from a GTT to a Collection (VA - Virtual Array), the cost skyrockets (78.000), but the difference in execution times between the two is very small. SELECT ... FROM TABLE(CAST(my_table_va as my_table_tt)) JOIN table2 ... JOIN table3 ... My question

Unable to improve query performance in postgresql

余生长醉 提交于 2020-03-04 17:12:03
问题 I am trying to join 9 tables together. The count and index of each tables are given below along with the query. Green color in screenshot indicates keys used to join. But please note that I have used another column for visit_occurrence table called visit_occurrence_id to join but it's not indexed DROP MATERIALIZED VIEW IF EXISTS cdm.dummy CASCADE; CREATE MATERIALIZED VIEW cdm.dummy as select f.person_id,f.gender_id from cdm.visit_occurrence a left join cdm.condition_occurrence b on a.person

Unable to improve query performance in postgresql

安稳与你 提交于 2020-03-04 17:10:19
问题 I am trying to join 9 tables together. The count and index of each tables are given below along with the query. Green color in screenshot indicates keys used to join. But please note that I have used another column for visit_occurrence table called visit_occurrence_id to join but it's not indexed DROP MATERIALIZED VIEW IF EXISTS cdm.dummy CASCADE; CREATE MATERIALIZED VIEW cdm.dummy as select f.person_id,f.gender_id from cdm.visit_occurrence a left join cdm.condition_occurrence b on a.person

Improve PostgresSQL aggregation query performance

╄→гoц情女王★ 提交于 2020-02-23 10:10:22
问题 I am aggregating data from a Postgres table, the query is taking approx 2 seconds which I want to reduce to less than a second. Please find below the execution details: Query select a.search_keyword, hll_cardinality( hll_union_agg(a.users) ):: int as user_count, hll_cardinality( hll_union_agg(a.sessions) ):: int as session_count, sum(a.total) as keyword_count from rollup_day a where a.created_date between '2018-09-01' and '2019-09-30' and a.tenant_id = '62850a62-19ac-477d-9cd7-837f3d716885'

Improve PostgresSQL aggregation query performance

試著忘記壹切 提交于 2020-02-23 10:09:39
问题 I am aggregating data from a Postgres table, the query is taking approx 2 seconds which I want to reduce to less than a second. Please find below the execution details: Query select a.search_keyword, hll_cardinality( hll_union_agg(a.users) ):: int as user_count, hll_cardinality( hll_union_agg(a.sessions) ):: int as session_count, sum(a.total) as keyword_count from rollup_day a where a.created_date between '2018-09-01' and '2019-09-30' and a.tenant_id = '62850a62-19ac-477d-9cd7-837f3d716885'

Complex query performance in MySQL InnoDB versus MyISAM

倾然丶 夕夏残阳落幕 提交于 2020-02-03 18:48:15
问题 I am running on MariaDB 10.0.15 on a 4GB RAM cloud server with Local SSD disk for database. My model: users <n---n> right_holders <n---n> tracks ---n> raw_detections I have this table raw_detections with more than 100 million records. I want to sum all raw_detections for a specific user in a specific period. This is the query that I am having problem: SELECT DATE(raw_detection.created_at), SUM(1) FROM `raw_detection` INNER JOIN `audio_sources` ON `audio_sources`.`id` = `raw_detection`.`audio

PostgresSQL Nested Loops - When does the planner decide to use Nested Loop when doing an INNER JOIN?

一个人想着一个人 提交于 2020-01-30 08:14:23
问题 I am running a query with an INNER JOIN where the planner decides to use a Nested Loop. I've figured out that it has do with the WHERE conditions as I have tried writing the query with different WHERE conditions so it returns the same result but does not use a Nested Loop. My question is why has the planner decided to make the different decisions when the queries appear to be identical as they both return the same result? The query runs in 77 secs with the Nested Loop and in 13 sec without,

Mysql Query performance very slow

谁都会走 提交于 2020-01-16 19:32:50
问题 The below query was taking more than 8 min and 900 000 rows processed. it is very slow and affect my product. I can't identify why the query getting slow, all index are set fine. explain SELECT COUNT(DISTINCT (cinfo.CONTACT_ID)) FROM cinfo INNER JOIN LTocMapping ON cinfo.CONTACT_ID = LTocMapping.CONTACT_ID WHERE (((((((((cinfo.COUNTRY LIKE '%Panama%') OR (cinfo.COUNTRY LIKE '%PANAMA%')) AND (((cinfo.CONTACT_EMAIL NOT LIKE '%test%') AND (cinfo.CONTACT_EMAIL NOT LIKE '%engine%')) OR (cinfo