Questions tagged [sql-optimization]

SQL Optimization refers to the process of testing and debugging SQL servers and queries in order to increase overall performance.

SQL Optimization refers to the process of testing and debugging SQL databases, servers and queries in order to increase the speed and performance and to reduce used resources.

Usually, SQL optimization can refer to:

  • SQL Query optimization, where the SQL queries are being optimized internally in order to be optimal and to use as little resources as possible.
  • Database (schema) optimization, where the database or schema itself is being optimized in order to minimize redundancy. In literature, this is also referred to as normalization.
  • SQL Server optimization, where server configuration is being modified in order to be optimal for the needs of the used application(s).
295 questions
0
votes
1 answer

can it be executed faster with big amount of data [MySQL]

is there any way how to optimize next query: EXPLAIN EXTENDED SELECT keyword_id, ck.keyword, COUNT( article_id ) AS cnt FROM career_article_keyword LEFT JOIN career_keywords ck USING ( keyword_id ) WHERE keyword_id IN ( SELECT keyword_id FROM…
user1016265
  • 2,307
  • 3
  • 32
  • 49
-1
votes
1 answer

Optimizing OUTER JOIN queries using filters from WHERE clause.(Query Planner)

I am writing a distributed SQL query planner(Query Engine). Data will be fetched from RDBMS(PostgreSQL) nodes involving network I/O. I want to optimize JOIN queries. Logical Order of Execution is: Do JOIN(make use of ON clause) Apply WHERE clause…
-1
votes
1 answer

How can I optimize this SQL code further to run faster

UPDATE N SET [actType] = 'X' FROM tableA N WHERE NOT EXISTS (SELECT 1 FROM tableA O WHERE O.clientCode = N.clientCode AND O.[userName] = N.[userName] AND …
Sai Kiran
  • 9
  • 1
-1
votes
2 answers

How to make a COUNT with better performace?

Im using this query, which takes 3 secounds to run. The table announces has 255k rows and the table address has 30k rows. SELECT COUNT(DISTINCT ad.id) as total_address FROM ( SELECT ad.id, an.id as announce_id, an.buy_price as buy_price, …
Tiago Castro
  • 421
  • 6
  • 20
-1
votes
1 answer

Page loading is very slow - how to properly optimize?

I'm working on a big page with different product statistics. I use there multiple charts, tables etc. It takes for example 5 seconds to load the page. This is a very simplified models.py EDIT For example, OccurencesTable contains this…
Milano
  • 18,048
  • 37
  • 153
  • 353
-1
votes
1 answer

receiving ORA 00907 while trying to load optimized SQL execution Plan into plan table

I am receiving error when loading SQL Plan into plan table. Can anyone help me? Here are my codes : APPS@PROD1> @xplan.sql ((t2.productgroup_id = 15520) AND (t1.productgroup_id = 15520) /* * ERROR at line…
Lily
  • 35
  • 1
  • 1
  • 6
-1
votes
1 answer

How can I improve the performance of this query?

In this query I make a "left join" with a table (ASPECT_CONTACT_EVENTS) that have many registers (In this period, 250.000). The table Promessas have a 200 registes in this period. SET @inicio = '2015-02-24 00:00:00'; SET @fim = '2015-02-24…
caezar
  • 197
  • 3
  • 15
-1
votes
2 answers

oracle 11g pivot query optimization - multiple rows to single row

I have below tables user table USER_ID USER_NAME 1 smith 2 clark 3 scott 4 chris 5 john property table P_ID PROPERTY 1 first_name 2 last_name 3 age 4 skill user_property…
KNale
  • 1
  • 1
  • 4
-2
votes
3 answers

How can I optimize a SQL query?

SELECT * FROM account a1 LEFT JOIN account a2 ON a1.group_id>0 AND a2.app_id=0 AND a1.group_id=a2.group_id AND a1.id!=a2.id JOIN user_account_ref uar ON uar.account_id=a1.id OR (uar.account_id=a2.id AND uar.role>0) WHERE uar.user_id IN…
peps
  • 75
  • 1
  • 1
  • 6
-2
votes
2 answers

Fast update query on millions table

I'm updating a table with million records with a simple query but its taking huge timimg, wondering if someone could bring some magic with alternative to speed the process query bellow UPDATE sources.product SET partial=left(full,7);
Jorge Vidinha
  • 404
  • 7
  • 20
1 2 3
19
20