3,135 questions
Best practices
1 vote
3 replies
74 views
Deleting large data without stopping the active mysql server
I'm using a table of approximately 1TB in a MySQL database. This table also has a monthly partition. We store the last two months of data in this table and regularly truncate the data from the ...
1 vote
5 answers
94 views
Grouping rows, and then deleting only a sub range (based on their dates) from each of those groups
I use Postgres on my web server in order to record incoming queries into a table calls2, basically writing a single row each time with lots of repeating information, such as a date field ("when&...
0 votes
2 answers
178 views
How to remove duplicate values that are NOT within a range from a MariaDB table?
I have a MariaDB table like this: CREATE TABLE metric_value ( id int(10) unsigned NOT NULL AUTO_INCREMENT, metric_id int(10) unsigned DEFAULT NULL, value decimal(17,2) unsigned NOT NULL, ...
-1 votes
1 answer
103 views
DELETE large amounts of data in TRANSACT SQL
I have an Excel file with approximately 300k records and I want to delete these rows from a SQL Server table. I tried using INSERT for each record but that takes way too long. I also tried to create a ...
0 votes
0 answers
23 views
Does NHibernate require bidirectional mappings for cascade delete?
If I have a very common shared table (ie. names) with a primary key (ie. name_id) included in many other tables as foreign keys, do I need my common table (names) to have a mapping reference to every ...
-1 votes
1 answer
58 views
How to reference the primary key to delete records based on the results of a select query using a composite primary key
Table_1 has a composite primary key: col_1, col_2. I find records that meet a certain criteria: select col_1, col_2 from thisTable where col_3 = 'criteria' Now I need to delete the records returned ...
4 votes
1 answer
227 views
Unable to delete items using Supabase Go client
I'm developing a REST API with Go and Gin framework that connects to Supabase. I've successfully implemented GET, POST, and PUT operations, but I'm having issues with the DELETE operation. What I've ...
0 votes
1 answer
94 views
Spring boot SQL error in deleting record with not-null constraint violation
In Spring boot I have two entity classes import java.time.OffsetDateTime; import java.util.Set; import java.util.UUID; import jakarta.persistence.*; import lombok.*; import org.apache.commons.lang3....
3 votes
1 answer
107 views
How do I DELETE with WHERE and IN using a composite primary key?
My table: create table x( name text, group integer, primary key(name, group) ) I want to delete from it by primary key: delete from x where primary key in (["a", 1], ["a", 2]...
3 votes
2 answers
117 views
Why is DELETE FROM vehicle_data WHERE NOW() > expires_at; failing in my stored function?
I have prepared a DB Fiddle for my question and I will also show my complete code below - I am trying to store data in a vehicle_data table and each data record has an expires_at column: -- Create ...
0 votes
1 answer
61 views
Duplicate Key violation unique constraint PostgreSQL History Tables
I have table_1 and table_1_history in PostgreSQL. I have setup a trigger for insert, update, delete on table_1. So any changes in table_1 will reflect to table_1_history and will create a new row. ...
1 vote
1 answer
108 views
SQL Server Deadlock Delete Insert Statement
Both a delete and insert (range) on the same table are causing a deadlock due to contention on the same primary key index. I don't understand why. The locks taken are RangeS-S by each process and the ...
2 votes
1 answer
65 views
different deleting OUTPUT behaviour based on source table
What I'm trying to achieve is a combined merge statement, that updates/deletes/moves data based on related metadata, somewhat like the following (MWS at the end): merge #data as target using #metadata ...
0 votes
2 answers
96 views
Python SQL executemany DELETE statement runs successfully without error for no matching records found
I have a file which has 100 of records to get deleted from a table. I'm using cx_oracle connect connection with executemany statement from Python to Oracle SQL and trying to delete the entire 100 ...
0 votes
1 answer
269 views
DataStage Oracle Connector doesn't execute 'After SQL statement'
I have a problem with an Oracle Connector. It should work as follows: 1 - Delete rows where the start date is equal to SYSDATE 2 - Insert data in that table 3 - Update rows with start date different ...