Questions tagged [loop]
5 questions
2
votes
3 answers
Why is my Nested Loops join showing inaccurate row estimates in SQL Server?
I have the following execution plan:
As you can see, the row estimates for the Clustered Index Scan and Index Seek operators are accurate. However, the Nested Loops join has a significant discrepancy: the actual row count is 6,420, while the…
Tuyen Nguyen
- 343
- 10
1
vote
2 answers
Procedure with nested FOR loop to update rows
I am trying to write a Postgres procedure in pgAdmin. The procedure I've written fails with different error messages depending on where I put the cursor. It even sometimes seems to succeed, but with no procedure created.
My questions:
What is wrong…
bellysavalas
- 13
- 4
0
votes
1 answer
PostgreSQL loop through selected tables
In PG 17, I need to run some maintenance on several tables (in the code below, I have listed only two), So after some research, I came up with the following script:
DO
$do$
BEGIN
FOR tablename IN ARRAY['materials', 'processes'] LOOP
DELETE…
Sig
- 455
- 1
- 5
- 14
0
votes
2 answers
Find all C.id where none of the rows of B have is_true='Y'?
There are two tables C and B.
They're connected by C.id=B.cid.
I need to find all the C.id es where:
None of the rows corresponding to cid has is_true='Y'
I've tried various queries but can't wrap my head around any of them. This is one of my…
achhainsan
- 159
- 1
- 6
-1
votes
2 answers
Merging Data From Multiple Tables With Nesting/Loops
Long story short I need to replace a website component with a newer one. Problem is the way the old one stored information in the database is very convoluted.
I have a new empty table (for the new component) with 3 columns:
| field_id | item_id |…
rudiments
- 7
- 2