Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

5 votes
2 answers
893 views
Kill infinite loop plperl
How can I kill session with infinite looped plperl function? Both `pg_terminate_backend` and `pg_cancel_backend` had no effect. `kill -1 pid` did nothing as well and `kill -9 pid` crashed server.
How can I kill session with infinite looped plperl function? Both pg_terminate_backend and pg_cancel_backend had no effect. kill -1 pid did nothing as well and kill -9 pid crashed server.
Łukasz Kamiński (173 rep)
Jul 27, 2018, 11:22 AM • Last activity: Feb 4, 2024, 03:30 PM
0 votes
0 answers
597 views
How to add logout button IN SSRS web page?
I have such question. Is it possible to add logout functionality for current user IN SSRS web page in browser?
I have such question. Is it possible to add logout functionality for current user IN SSRS web page in browser?
Robert Margaryan (1 rep)
Feb 2, 2024, 12:40 PM
5 votes
1 answers
1485 views
how to kill a rogue spid that is already killed?
I have an obstinate spid that I cannot [kill][1] and it is preventing the transaction log of [my tempdb][2] to get truncated this is how [I found][3] this rogue spid: if object_id('tempdb..#OpenTranStatus','U') is not null drop table #OpenTranStatus CREATE TABLE #OpenTranStatus ( ActiveTransaction v...
I have an obstinate spid that I cannot kill and it is preventing the transaction log of my tempdb to get truncated this is how I found this rogue spid: if object_id('tempdb..#OpenTranStatus','U') is not null drop table #OpenTranStatus CREATE TABLE #OpenTranStatus ( ActiveTransaction varchar(25), Details sql_variant ); -- Execute the command, putting the results in the table. INSERT INTO #OpenTranStatus EXEC ('DBCC OPENTRAN (sqlwatch) with tableresults') SELECT * FROM #OpenTranStatus enter image description here this is the query it is running (or holding on to): select d.database_id , sd.sqlwatch_database_id, sd.sql_instance into #d from dbo.vw_sqlwatch_sys_databases d inner join [dbo].[sqlwatch_meta_database] sd on sd.[database_name] = d.[name] collate database_default and sd.[database_create_date] = case when d.name = 'tempdb' then '1970-01-01 00:00:00.000' else d.[create_date] end and sd.sql_instance = @sql_instance left join [dbo].[sqlwatch_config_exclude_database] ed on d.[name] like ed.database_name_pattern collate database_default and ed.snapshot_type_id = @snapshot_type_id where ed.snapshot_type_id is null option (keep plan) it has been running for over 60 hours: enter image description here It has already been killed. so the things I have tried doing: alter database sqlwatch set single_user with rollback immediate but it did not work kill 54 with statusonly > SPID 54: transaction rollback in progress. Estimated rollback > completion: 0%. Estimated time remaining: 0 seconds. enter image description here question: how can I stop spid54?
Marcello Miorelli (17274 rep)
Dec 20, 2023, 12:28 PM • Last activity: Dec 20, 2023, 01:05 PM
2 votes
0 answers
790 views
MariaDB: Terminate long-running clearnup process?
This is a follow up to my [previous question](https://dba.stackexchange.com/questions/325259/mariadb-large-insert-select-query-failed-without-generating-an-error) about a long-running `INSERT SELECT` query that may have exceeded the `max_statement_time` and was `Killed`. It has been in the `Reset fo...
This is a follow up to my [previous question](https://dba.stackexchange.com/questions/325259/mariadb-large-insert-select-query-failed-without-generating-an-error) about a long-running INSERT SELECT query that may have exceeded the max_statement_time and was Killed. It has been in the Reset for next command state for 3.5 days. I think it is rolling back changes on the table I was inserting into. However, that table was empty to begin with, and I would rather terminate this cleanup process, drop the table, and start fresh than continue waiting for it to finish. But I do not know if that would be safe for the general health of the database. The table that I was copying into had no keys, and thus no foreign_key constraints. It was a bare table that I was planning to index once populated. What is the quickest way for me to get back to work without doing more harm?
Id   User         Host           db Command    Time                   State
10237   root    localhost   singlecell  Killed  300819  Reset for next command
Chris Cox (43 rep)
Mar 28, 2023, 02:30 PM
8 votes
2 answers
926 views
Does killed session appears in Query Store?
Is there any option to see killed sessions in Query Store? I am asking, because we have an additional tool which is terminating sessions if they take more than 30 minutes to run (`KILL` command). I would like to check the execution plans in the Query Store for queries that have been terminated. I ca...
Is there any option to see killed sessions in Query Store? I am asking, because we have an additional tool which is terminating sessions if they take more than 30 minutes to run (KILL command). I would like to check the execution plans in the Query Store for queries that have been terminated. I can not find in query store sessions/queries which were killed by this additional application.
adam.g (465 rep)
Feb 17, 2022, 09:07 PM • Last activity: Feb 18, 2022, 11:04 AM
1 votes
0 answers
1080 views
Process with Command 'Killed' and State 'Executing'. Not getting killed
Last day, when I ran a count(*) query on a table. It didn't provide any results. It ran forever even. So I tried killing those queries (I have tried it multiple times). As I'm using AWS RDS, I killed the session using > CALL mysql.rds_kill(pid); When I checked the processlist, it was showing **Kille...
Last day, when I ran a count(*) query on a table. It didn't provide any results. It ran forever even. So I tried killing those queries (I have tried it multiple times). As I'm using AWS RDS, I killed the session using > CALL mysql.rds_kill(pid); When I checked the processlist, it was showing **Killed** in the Command column and **Executing** in the State column. Why is it now killing it? The main issue is, the CPU is hitting 100% from the time when I ran this query. Even after I ran this kill command, it stays at 100%. As I'm a newbie in DB, I would like to know why it was not getting killed fully. I have read about the time taking for rollback even after we kill a process. But here, I just tried a count(*) query. Where can I find details regarding this? Right now, I have rebooted to bring down the CPU. But if this happens in production, things will get messed up, right? Any help for getting details regarding this issue would be really helpful. Thanks.
Neron Joseph (111 rep)
Jul 17, 2020, 04:12 AM • Last activity: Aug 31, 2020, 10:48 PM
1 votes
2 answers
19302 views
Cleanup of Oracle killed session
I killed a session ALTER SYSTEM KILL SESSION '123,456' IMMEDIATE; But it remains in `v$session` for 10 days, although an attached process is absent in `v$processes`. SELECT s.username, s.osuser, s.sid, s.serial#, p.spid FROM v$session s, v$process p WHERE s.sid = '123' AND p.addr (+)= s.paddr; I've...
I killed a session ALTER SYSTEM KILL SESSION '123,456' IMMEDIATE; But it remains in v$session for 10 days, although an attached process is absent in v$processes. SELECT s.username, s.osuser, s.sid, s.serial#, p.spid FROM v$session s, v$process p WHERE s.sid = '123' AND p.addr (+)= s.paddr; I've also checked all Linux processes related to Oracle and found no zombies: all present processes are consistent to alive sessions. This happens not for all the killed sessions. It seems that PMON is active, because the most of the killed sessions are cleaned from the list in a reasonable time (often it takes a second). What can be done to eliminate long-playing killed session from the list?
diziaq (131 rep)
Aug 21, 2017, 07:54 AM • Last activity: Aug 6, 2020, 09:28 PM
2 votes
1 answers
2002 views
Kill concurrent materialized view refresh PID
Concurrent refreshes of materialized views don't have a record in `pg_stat_activity`, other than the initial (~immediately completing) query to start them. Is there some other way to obtain the PID, in order to `perform pg_terminate_backend(pid)`?
Concurrent refreshes of materialized views don't have a record in pg_stat_activity, other than the initial (~immediately completing) query to start them. Is there some other way to obtain the PID, in order to perform pg_terminate_backend(pid)?
OJFord (125 rep)
May 14, 2020, 08:44 AM • Last activity: May 14, 2020, 09:11 AM
9 votes
1 answers
16068 views
How to terminate a suspended SQL Server transaction waiting for IO_COMPLETION?
We have a transaction that has been running for more than 5 hours. We are running out of disk space. The session has been killed but it is still waiting for IO_COMPLETION. Actually the wait_type just changed to PAGEIOLATCH_EX. How can I terminate the suspended SQL Server transaction? I am not worrie...
We have a transaction that has been running for more than 5 hours. We are running out of disk space. The session has been killed but it is still waiting for IO_COMPLETION. Actually the wait_type just changed to PAGEIOLATCH_EX. How can I terminate the suspended SQL Server transaction? I am not worried about losing data since all of it can be repopulated. session_id: 54 STATUS: suspended blocked by: 0 wait_type: PAGEIOLATCH_EX Elapsed Time (in Sec): 19750.420000 open_transaction_count: 2
Tarzan (557 rep)
Jun 3, 2015, 04:20 PM • Last activity: May 13, 2020, 06:49 PM
8 votes
4 answers
3121 views
Delete statement not responding to Kill session command
Four days ago a user ran the command below on a table with 400,000,000 rows. It's still running and the log file is increasing in size. delete from [table-name] This table does have a foreign key constraint which is not enabled for checking and I know that no rows exist in the other table. The datab...
Four days ago a user ran the command below on a table with 400,000,000 rows. It's still running and the log file is increasing in size. delete from [table-name] This table does have a foreign key constraint which is not enabled for checking and I know that no rows exist in the other table. The database is running with "Is Read Committed Snapshot On" enabled and in Simple recovery mode. After this had run for a few hours I issued a kill session command, because we were running out of disk space for the log file. I added another log file to allow the system to continue to function. The log file is continuing to grow and when I run kill session with statusonly it returns this message: SPID 123: transaction rollback in progress. Estimated rollback completion: 0%. Estimated time remaining: 0 seconds. I am at a loss as to what to do about this query to get it to rollback and also just understanding what is going on, can anyone suggest what I can look at?
David Woakes (183 rep)
Apr 6, 2020, 01:10 PM • Last activity: Apr 23, 2020, 07:34 PM
2 votes
1 answers
2002 views
Process was intentionally killed - now the process is still showing in "show processlist "
We had a MariaDB long-running process (40 hours), so I killed the thread. But, the thread is still there, with: - showing `Command` as `Killed`. - a `State` of `Unlocking tables`. - `Info` is `insert into ...` What does this mean? More importantly, how do I get rid of it? It's been over 31 hours sin...
We had a MariaDB long-running process (40 hours), so I killed the thread. But, the thread is still there, with: - showing Command as Killed. - a State of Unlocking tables. - Info is insert into ... What does this mean? More importantly, how do I get rid of it? It's been over 31 hours since the thread entered the "Killed" state. UPDATE: We restarted the container running MariaDB. There was no indication of anything wrong but... Would it make sense to recast this thread to be now about how to check for errors in the database (My MariaDB skills are rudimentary) or should I start a new thread?
David Rogers (123 rep)
Apr 20, 2020, 11:41 PM • Last activity: Apr 23, 2020, 06:44 PM
4 votes
2 answers
9356 views
Queries on large database kill connection to the server, works with LIMIT
I'm trying to run queries on a large-ish database without killing the connection to the server. I'm using Postgres 12.1 on a mac with 16gb of memory, and about 40gb of free disk. The database is 78gb according to `pg_database_size` with the largest table being 20gb according do `pg_total_relation_si...
I'm trying to run queries on a large-ish database without killing the connection to the server. I'm using Postgres 12.1 on a mac with 16gb of memory, and about 40gb of free disk. The database is 78gb according to pg_database_size with the largest table being 20gb according do pg_total_relation_size. The error I get (from the log), regardless of which non-working query I run, is:
server process (PID xxx) was terminated by signal 9: Killed: 9
In VS code the error is "lost connection to server". Two examples that don't work are:
UPDATE table
SET column = NULL
WHERE column = 0;
select columnA
from table1
where columnA NOT IN (
select columnB
from table2
);
I can run some of the queries (the above one, for example) by adding a LIMIT of, say, 1,000,000. I suspected that I was running out of disk due to temp files, but in the log (with log_temp_files = 0), I can't see any temp files being written. I tried increasing and decreasing work_mem, maintenance_work_mem, shared_buffers, and temp_buffers. None worked, the performance was about the same. I tried dropping all indexes, which brought down the "cost" on some of the queries, but they still killed the connection to the server. What could be my problem and how can I troubleshoot this further? Additionally, I [read](https://www.postgresql-archive.org/Removing-pgsql-tmp-files-td3255748.html) that temp files from timed-out queries are stored in pqsql_tmp. I checked the folder, and it does not have files of significant size. Could the temp files be stored somewhere else? --- The posgtres log for running a failed query looks like:
2020-02-17 09:31:08.626 CET  LOG:  server process (PID xxx) was terminated by signal 9: Killed: 9
2020-02-17 09:31:08.626 CET  DETAIL:  Failed process was running: update table
        set columnname = NULL
        where columnname = 0;

2020-02-17 09:31:08.626 CET  LOG:  terminating any other active server processes
2020-02-17 09:31:08.626 CET  WARNING:  terminating connection because of crash of another server process
2020-02-17 09:31:08.626 CET  DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exi$
2020-02-17 09:31:08.626 CET  HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2020-02-17 09:31:08.626 CET  WARNING:  terminating connection because of crash of another server process
2020-02-17 09:31:08.626 CET  DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exi$
2020-02-17 09:31:08.626 CET  HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2020-02-17 09:31:08.629 CET  LOG:  all server processes terminated; reinitializing
2020-02-17 09:31:08.698 CET  LOG:  database system was interrupted; last known up at 2020-02-17 09:30:57 CET
2020-02-17 09:31:08.901 CET  LOG:  database system was not properly shut down; automatic recovery in progress
2020-02-17 09:31:08.906 CET  LOG:  invalid record length at 17/894C438: wanted 24, got 0
2020-02-17 09:31:08.906 CET  LOG:  redo is not required
--- Running EXPLAIN on the second example query returns:
Seq Scan on gas_prices_all p  (cost=459.93..5635583.33 rows=128975016 width=16)
  Filter: (NOT (hashed SubPlan 1))
  SubPlan 1
    ->  Seq Scan on gas_station g  (cost=0.00..423.14 rows=14714 width=16)
JIT:
  Functions: 13
  Options: Inlining true, Optimization true, Expressions true, Deforming true
FWIW I get the same error for queries with "cost" around zero. --- Update: I found a crash report from earlier today:
Process:               postgres 
Path:                  /Users/USER/*/postgres
Identifier:            postgres
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        postgres 
Responsible:           postgres 
User ID:               502

Date/Time:             2020-02-18 11:16:26.210 +0100
OS Version:            Mac OS X 10.14.5 (18F132)
Report Version:        12
Anonymous UUID:        F41CCD21-C558-6CB0-316D-D1FF3E279576

Sleep/Wake UUID:       5F08EAEC-373A-4D19-A243-E812E68D2697

Time Awake Since Boot: 1600000 seconds
Time Since Wake:       5700 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (Code Signature Invalid)
Exception Codes:       0x0000000000000032, 0x00000001044c4060
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 0x2

kernel messages:

VM Regions Near 0x1044c4060:
    __LINKEDIT             0000000104466000-00000001044c4000 [  376K] r--/rw- SM=COW  /Users/USER/*/*.dylib
--> VM_ALLOCATE            00000001044c4000-00000001044c5000 [    4K] r-x/rwx SM=ZER  
    VM_ALLOCATE            00000001044c5000-00000001044c6000 [    4K] rw-/rwx SM=ZER  

Application Specific Information:
crashed on child side of fork pre-exec

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                           	0x00000001044c4060 0 + 4367073376
1   postgres                      	0x0000000103798851 ExecAgg + 1185 (executor.h:308)
2   postgres                      	0x0000000103785d0f standard_ExecutorRun + 287 (execMain.c:1652)
3   postgres                      	0x0000000103789c4e ParallelQueryMain + 670 (execParallel.c:1405)
4   postgres                      	0x00000001036520ce ParallelWorkerMain + 1054 (parallel.c:1434)
5   postgres                      	0x000000010385bec5 StartBackgroundWorker + 533 (bgworker.c:834)
6   postgres                      	0x000000010386acb9 maybe_start_bgworkers + 1161
7   postgres                      	0x00000001038696c5 sigusr1_handler + 357 (postmaster.c:5167)
8   libsystem_platform.dylib      	0x00007fff76195b5d _sigtramp + 29
9   ???                           	0x0000000000003200 0 + 12800
10  postgres                      	0x00000001037d54ae main + 1678
11  libdyld.dylib                 	0x00007fff75faa3d5 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00000001044c4060  rbx: 0x00007f98b9045600  rcx: 0x00000001072c48d8  rdx: 0x00007ffeec6242f4
  rdi: 0x00007f98b9047520  rsi: 0x00007f98b9045fc0  rbp: 0x00007ffeec624320  rsp: 0x00007ffeec624288
   r8: 0x00000000014bafca   r9: 0xffffffff00000000  r10: 0x00000001072c48d0  r11: 0x0000000000000005
  r12: 0x0000000103c51220  r13: 0x00007f98b9047510  r14: 0x00007f98b9045fc0  r15: 0x00007f98b90459a0
  rip: 0x00000001044c4060  rfl: 0x0000000000010246  cr2: 0x00000001044c4060
  
Logical CPU:     0
Error Code:      0x00000015
Trap Number:     14


Binary Images:
      **lots of stuff**

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 134420121
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=398.8M resident=0K(0%) swapped_out_or_unallocated=398.8M(100%)
Writable regions: Total=4.2G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=4.2G(100%)
 
                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                    8K        1 
MALLOC                            81.0M       19 
MALLOC guard page                   16K        3 
MALLOC_LARGE (reserved)             72K        2         reserved VM address space (unallocated)
STACK GUARD                       56.0M        1 
Stack                             8192K        1 
VM_ALLOCATE                        4.1G        4 
__DATA                            18.0M      200 
__FONT_DATA                          4K        1 
__LINKEDIT                       232.2M       11 
__TEXT                           166.6M      199 
__UNICODE                          564K        1 
mapped file                         64K        1 
shared memory                      552K        6 
===========                     =======  ======= 
TOTAL                              4.7G      450 
TOTAL, minus reserved VM space     4.7G      450
I can find two maybe-interesting things in the log:
2020-02-18 19:01:52.044375+0100  localhost kernel: CODE SIGNING: process 51528[postgres]: rejecting invalid page at address 0x1100c1000 from offset 0x0 in file "" (cs_mtime:0.0 == mtime:0.0) (signed:0 validated:0 tainted:0 nx:0 wpmapped:1 dirty:0 depth:0)
2020-02-18 19:01:52.044805+0100  localhost ReportCrash: unknown nested kcdata type: 0x1004, size: 2108
2020-02-18 19:01:55.268060+0100  localhost ReportCrash: (CrashReporterSupport) Saved crash report for postgres version 0 to postgres_2020-02-18-190155_MacBook-Pro.crash
2020-02-18 19:01:55.273159+0100  localhost ReportCrash: (CrashReporterSupport) Removing excessive log: postgres_2020-02-18-190155_MacBook-Pro.crash
2020-02-18 19:01:55.274208+0100  localhost ReportCrash: shouldDisplayUnexpectedlyQuitNotification is NO
--- UPDATE: I ran the second exaple query (above) with LIMIT until it went from working (LIMIT of 2,200,000) to killing the connection to the server (LIMIT of 2,300,000). EXPLAIN ANALYZE on the LIMIT 2,200,000 query is:
Limit  (cost=459.93..96581.42 rows=2200000 width=16) (actual time=13.228..38573.440 rows=2200000 loops=1)
  ->  Seq Scan table1  (cost=459.93..5635583.33 rows=128975016 width=16) (actual time=13.227..38374.070 rows=2200000 loops=1)
        Filter: (NOT (hashed SubPlan 1))
        Rows Removed by Filter: 139729529
        SubPlan 1
          ->  Seq Scan on table2  (cost=0.00..423.14 rows=14714 width=16) (actual time=0.350..6.925 rows=14714 loops=1)
Planning Time: 0.138 ms
Execution Time: 38685.762 ms
EXPLAIN on the LIMIT 2,300,000 is: (EXPLAIN ANALYZE crashed here)
Limit  (cost=459.93..100950.58 rows=2300000 width=16)
  ->  Seq Scan on table1  (cost=459.93..5635583.33 rows=128975016 width=16)
        Filter: (NOT (hashed SubPlan 1))
        SubPlan 1
          ->  Seq Scan on table2  (cost=0.00..423.14 rows=14714 width=16)
JIT:
  Functions: 14
  Options: Inlining false, Optimization false, Expressions true, Deforming true
I'm reading this as JIT kicking in here, which makes sense given jit_above_cost is set (default) to 100,000. So perhaps the problem is with the JIT somehow? --- UPDATE 2: With jit=off the second example query works and is also ca. twice as fast. How can that be and what could cause JIT to be a problem on my system?
doeeehunt (51 rep)
Feb 18, 2020, 01:18 PM • Last activity: Feb 27, 2020, 03:31 PM
4 votes
3 answers
17082 views
Grant permission to KILL connections (sessions) for certain databases only?
For a SQL Server on a VM/physical box (not Azure SQL database!) Is this possible to grant KILL permission, but in a way that grantee can kill connections only for certain databases ? I would not want to grant this user ability to kill any connection, but just 1 database Thanks!!
For a SQL Server on a VM/physical box (not Azure SQL database!) Is this possible to grant KILL permission, but in a way that grantee can kill connections only for certain databases ? I would not want to grant this user ability to kill any connection, but just 1 database Thanks!!
Aleksey Vitsko (6195 rep)
Sep 13, 2017, 09:07 AM • Last activity: Oct 5, 2019, 09:52 PM
2 votes
1 answers
3563 views
How to immediately terminate a SPID with a very long rollback time estimated?
I have a script to restore a database from a backup. Prior to the restore command, it has: set single_user with rollback immediate The script seemed to be hanging here. I used `sp_who2` to find out a SPID number 70 was in ROLLBACK state. I then used `kill 70 with statusonly` to obtain estimated time...
I have a script to restore a database from a backup. Prior to the restore command, it has: set single_user with rollback immediate The script seemed to be hanging here. I used sp_who2 to find out a SPID number 70 was in ROLLBACK state. I then used kill 70 with statusonly to obtain estimated time remaining - and it translates to more than 20,000 hours. How can I arrest this rollback, even if it means the DB ends up in a transactionally inconsistent state? (I don't really care, as I just want to restore it from a backup.) Is my only option to shut down the server (and impact other DBs on that server)?
youcantryreachingme (1655 rep)
Nov 8, 2018, 11:43 PM • Last activity: Mar 7, 2019, 04:06 AM
6 votes
1 answers
4960 views
Using TCP keepalive for terminating orphan postgres queries not working
**Problem**: A user of some application executes a report which involves a heavy sql query. After some minutes, the user then quits the application (or even worse, the app crashes, or the connection to the database server is lost). The query however continues its execution, *even when it is no more...
**Problem**: A user of some application executes a report which involves a heavy sql query. After some minutes, the user then quits the application (or even worse, the app crashes, or the connection to the database server is lost). The query however continues its execution, *even when it is no more needed*. So I've read about these types of situations and how to handle them, and it is suggested to use TCP Keepalive configuration . The problem is that it looks like postgres is ignoring this configuration. I've lowered the original configuration values both at "postgres level" and at "OS level", with no luck: - **postgresql.conf** - tcp_keepalives_idle = 60 - tcp_keepalives_interval = 6 - tcp_keepalives_count = 10 - **Ubuntu** - echo 60 > /proc/sys/net/ipv4/tcp_keepalive_time - echo 10 > /proc/sys/net/ipv4/tcp_keepalive_intvl - echo 6 > /proc/sys/net/ipv4/tcp_keepalive_probe I even tried reloading/restarting postgres but nothing worked, the query keeps running past two minutes until the very end. ¿Is there any additional step I am missing? **EDIT**: Result of pg_stat_activity: datid | datname | procpid | usesysid | usename | current_query | waiting | xact_start | query_start | backend_start | client_addr | client_port ----------+--------------------------------------------+---------+----------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+-------------------------------+-------------------------------+-------------------------------+-------------+------------- 467061608 | libertya_prod_hts_rg1_20161004_qafuncional | 16716 | 16384 | libertya | SELECT dt.signo_issotrx, dt.name as tipodoc, i.ad_org_id, i.ad_client_id, i.documentno, i.c_invoice_id as doc_id, i.c_order_id, i.c_bpartner_id, bp.name as bpartner, i.issotrx, i.dateacct, i.dateinvoiced as datedoc, p.netdays, i.dateinvoiced + (p.netdays::text || ' days'::text)::interval AS duedate, paymenttermduedays(i.c_paymentterm_id, i.dateinvoiced::timestamp with time zone, now()) AS daysdue, i.dateinvoiced + (p.discountdays::text || ' days'::text)::interval AS discountdate, round(i.grandtotal * p.discount * 0.01::numeric, 2) AS discountamt, i.grandtotal AS grandtotalmulticurrency, invoicepaid(i.c_invoice_id, i.c_currency_id, 1) AS paidamtmulticurrency, invoiceopen(i.c_invoice_id, 0, i.c_currency_id,i.c_conversiontype_id) AS openamtmulticurrency, currencybase(i.grandtotal,i.c_currency_id,i.dateinvoiced, i.ad_client_id, i.ad_org_id) AS grandtotal, invoicepaid(i.c_invoice_id, 118, 1) AS paidamt, invoiceopen(i.c_invoice_id, 0,118,i.c_conversiontype_id) AS openamt, i.c_currency_id, i.c_conversiontype_id, i. | f | 2017-04-07 08:06:23.896404-03 | 2017-04-07 08:06:24.513244-03 | 2017-04-07 08:06:02.817331-03 | 127.0.0.1 | 59354
Federico Cristina (173 rep)
Apr 6, 2017, 02:40 PM • Last activity: Feb 12, 2018, 10:42 AM
0 votes
3 answers
524 views
after executing a back up cmd (via query) how to kill it
I have a big database (150 GB) that needs a back up and I don't have space in current machine, so I am pointing it to the different box which has space. After executing the cmd, it is executing the query but taking long time, not showing stats also. Query used: backup database [DBName] to disk = '\\...
I have a big database (150 GB) that needs a back up and I don't have space in current machine, so I am pointing it to the different box which has space. After executing the cmd, it is executing the query but taking long time, not showing stats also. Query used: backup database [DBName] to disk = '\\Servername\H:\Backup7-7-2017\dbname.bak' with copy_only, stats = 1 go It is running for more than 5 minutes and no change on stats, and in destination folder the file is not created yet, so I am planning to go for manual backup from GUI. Now I want to kill this running backup as it is in suspended mode, when I checked in activity monitor.
Harris Hilton (1 rep)
Jul 7, 2017, 03:00 PM • Last activity: Jul 9, 2017, 02:19 AM
1 votes
1 answers
2293 views
what is "killcursors: found 0 of 1" from mongodb.log with replicaset?
This is output of `mloginfo log --distinct`. What does killcursors mean exactly and what's the DBA action? We use latest mongod in a 3 node replicaset. With a search engine i found only on mongodb-user mailing list > Killcursors is a database command that removes cursor references on > the server. I...
This is output of mloginfo log --distinct. What does killcursors mean exactly and what's the DBA action? We use latest mongod in a 3 node replicaset. With a search engine i found only on mongodb-user mailing list > Killcursors is a database command that removes cursor references on > the server. It's normal and harmless. You'll probably only get an > exception when inserting in safe mode. I wish more info. source: mongodb.log host: example start: 2016 Jul 15 07:35:28.419 end: 2016 Aug 19 08:00:15.874 date format: iso8601-local length: 244025 binary: mongod version: 3.2.8 storage: wiredTiger DISTINCT 64062 connection accepted from ... # ... ( ... now open) 63984 end connection ... ( ... now open) 4 killcursors: found ... of 3 assertion ... ns: ... query: 1 git version: 1 waiting for connections on port Logs 2016-08-05T15:29:36.935+0200 I COMMAND [conn39339] killcursors: found 0 of 1 2016-08-05T15:29:36.937+0200 I COMMAND [conn39327] killcursors: found 0 of 1 2016-08-05T15:29:36.945+0200 I COMMAND [conn39329] killcursors: found 0 of 1 2016-08-05T15:29:36.946+0200 I COMMAND [conn39343] killcursors: found 0 of 1
Sybil (2578 rep)
Aug 19, 2016, 07:04 AM • Last activity: Aug 20, 2016, 09:37 AM
0 votes
2 answers
11883 views
KILLED/ROLLBACK query doesn't stop running
I've tried to kill a query on ms sql server management studio. Now it has the status killed/rollback. When I use: kill 74 with statusonly it doesn't make any progress. It is still at 0%. How can I delete this query without restarting the sql server? I will really appreciate all your answers.
I've tried to kill a query on ms sql server management studio. Now it has the status killed/rollback. When I use: kill 74 with statusonly it doesn't make any progress. It is still at 0%. How can I delete this query without restarting the sql server? I will really appreciate all your answers.
Ezra P. (1 rep)
Jun 24, 2016, 11:48 AM • Last activity: Jun 25, 2016, 05:15 PM
3 votes
2 answers
8215 views
Linux command to kill all MySQL sessions from a specific User?
How can i kill all sessions from a user in mysql using a linux command line command? I have a user that is using all on my database connections and insted of killing one by one i want to make a script to kill them all !
How can i kill all sessions from a user in mysql using a linux command line command?
I have a user that is using all on my database connections and insted of killing one by one i want to make a script to kill them all !
user_bump (49 rep)
Mar 22, 2014, 05:04 PM • Last activity: May 2, 2016, 09:19 AM
4 votes
1 answers
6881 views
How to stop the execution of a long running insert query?
I've executed an `INSERT INTO ... SELECT` as a job on my MySQL instance and then I realized that number of records that is selected by the `WHERE` condition is more than my patience. It's already taken 12 hours and there's no sign of the job being done. My previous experience tells me that there's a...
I've executed an INSERT INTO ... SELECT as a job on my MySQL instance and then I realized that number of records that is selected by the WHERE condition is more than my patience. It's already taken 12 hours and there's no sign of the job being done. My previous experience tells me that there's a big chance to corrupt the data if I just kill / stop the MySQL instance. And I know no other way to do so! Does anyone know a safe way to gracefully ask MySQL to stop whatever it is doing? And I'm using InnoDb and MySQL 5.6 on Ubuntu.
Mehran (145 rep)
Apr 16, 2014, 05:19 AM • Last activity: Apr 16, 2014, 12:12 PM
Showing page 1 of 20 total questions