Skip to main content

All Questions

Tagged with
1 vote
1 answer
81 views

SQLServer join order

From the SQLServer SELECT docs: The following steps show the logical processing order, or binding order, for a SELECT statement. This order determines when the objects defined in one step are made ...
David542's user avatar
  • 108k
2 votes
1 answer
267 views

Understanding a SQL Server execution plan

I have the following query which I'm using to review the SQL Server execution plan. SELECT TOP 1000 fact.division, case when fact.division='east' then 'XXX' else 'YYY' end div, count(1) ...
David542's user avatar
  • 108k
2 votes
1 answer
790 views

PostgreSQL EXPLAIN: How do I see a plan AS IF certain tables had millions of rows?

This is a question about PostgreSQL's EXPLAIN command. This command shows you how the optimizer will execute your SQL based on the data in your tables. We are not in prod yet, so all of our tables ...
Daniel Kaplan's user avatar
0 votes
1 answer
356 views

Oracle filter by max date

I'am searching for the best way to filter a table by a MAX date. Is it better to find with a select in the where SELECT * FROM table1 foo WHERE foo.date_tmp = ( ...
adex's user avatar
  • 115
0 votes
2 answers
167 views

Oracle DDL statment ( like CTAS) , after executed, not show in V$SQL

Why Oracle "DDL" statements (like "CTAS"), after executed, does not shown in V$SQL view ? How can get "SQL_ID" of that? I want to use "SQL_ID" in SQl plan ...
Yaser's user avatar
  • 57
1 vote
1 answer
79 views

Show estimate vs actual estimations in query plan

For some reason my plans dont show an actual vs estimation in the designer query plan. I have seen these show on Brent Ozar videos. How do I get those to show?
Mike Flynn's user avatar
  • 24.1k
0 votes
1 answer
145 views

Stored procedure has different plans in different databases, can't replicate better plan in main database

Can you point me in the right direction on where to look to figure out why one plan cache is different from the other one in another database. One database is older and has less data but the schema ...
Mike Flynn's user avatar
  • 24.1k
1 vote
2 answers
1k views

Improving the query processing performance of SUM and JOIN SQL

SELECT SUM(C_QUANTITY) FROM CARS JOIN ORDERS ON C_ORDERKEY = O_ORDERKEY; I have this query that aggregate sum of L_QUANTITY from the JOIN tables. The query cost, by using EXPLAIN PLAN is 12147. The ...
Sunny J's user avatar
  • 47
0 votes
0 answers
68 views

Can you increase the time SQL Server's Query Optimizer has to find the Best Query Plan?

"...the optimizer is not built to select the best execution plan, but instead to search and find the best possible plan after a set amount of time passes." Hoping to find a way to override ...
mud_punk's user avatar
0 votes
2 answers
2k views

Postgres subqueries running extremely slow, Why?

I've found queries that are sometimes slow to respond and are looking at the execution (explain analyze) plan. I think the joining part in the subquery is slow, but looking at the execution plan, I ...
Junki Yoon's user avatar
0 votes
1 answer
156 views

High cost SQL shows low cost when testing with parameters in SQL Server

My activity monitor shows this high cost query being run below without the value for DivisionPoolId and a high cost to run. I test it out with a real DivisionPoolId and the cost is low. I am not ...
Mike Flynn's user avatar
  • 24.1k
3 votes
2 answers
2k views

Performance impact of view on aggregate function vs result set limiting

The problem Using PostgreSQL 13, I ran into a performance issue selecting the highest id from a view that joins two tables, depending on the select statement I execute. Here's a sample setup: CREATE ...
Dominik's user avatar
  • 1,702
0 votes
1 answer
99 views

When mysql updates a non-indexed column,why can use the primary key

MySQL version is 8.0.23 Create table and insert data CREATE TABLE `test_update` ( `id` int NOT NULL , `column1` varchar(20) DEFAULT NULL, `column2` varchar(20) DEFAULT NULL, ...
Hedwig's user avatar
  • 1
2 votes
2 answers
690 views

How do I obtain a Query Execution Plan in Oracle IDEs?

In Oracle IDEs, such as Navigator, Toad, Oracle SqlDeveloper how can I get a query execution plan for a query / stored procedure? I can find some commands for them online, even though I am not able to ...
Isi's user avatar
  • 123
0 votes
0 answers
40 views

Regex join query optimization in PostgresSQL

How can I optimize this query below, it took 8 hrs to run : create table rtime.rtime_calc1_jun13tojun19 as( explain select pa.api as pa_api, pa.action_type as pa_action_type, max(rt.request_time), ...
user2533630's user avatar

15 30 50 per page
1
3 4
5
6 7
36