All Questions

Filter by
Sorted by
Tagged with
0
votes
2answers
30 views

Postgres: Vacuum taking too long

I have a database currently sitting on ~6B live tuples, ~4B dead tuples. I've ran the VACUUM command for 3 days now, and then suddenly my internet died. Meaning i lost all progress. How can i speed ...
0
votes
1answer
20 views

Inline expansion of inline composite expression

I want something like this: SELECT 1, (CASE WHEN TRUE THEN (2, 3) ELSE (4, 5) END).*; ...hoping to get 1 | 2 | 3. But in PostgreSQL 11 this query throws: ERROR: record type has not been ...
0
votes
0answers
5 views

I need to know how many connections are using mongodb when an error comes up

According with this https://stackoverflow.com/questions/7446528/mongodb-c-sharp-driver-doesnt-release-connections-then-errors it doesn't really close the connections used, there's a way to know how ...
1
vote
1answer
29 views

Best Indexes For Group By + Join + Where Condition

I have a database that includes the tables shown below: CREATE TABLE metadata ( keyword_id bigint NOT NULL, campaign_id bigint NOT NULL, org_id bigint NOT NULL, keyword character ...
0
votes
2answers
41 views

Should I query from a snapshot or use a backup for reporting purposes

I have a very large select query for reporting purposes that can take up to 1-2 hours to run. There are a few issues with this query. It takes up too much system resources and this server can't ...
3
votes
1answer
66 views

Raise Error Concatenation in SQL Server

Step 1 :I created a custom error message in sys.messages EXEC sp_addmessage @msgnum = 50001, @severity = 10, @msgtext = N'Error 50001, severity 10, state 1 was raised, ...
-2
votes
1answer
74 views

generate views from meta data using STRING_AGG function

I want to generate the DDL for views from a table of meta data. Since every value for my_column_name maps to a single short_column_names the order is important. If they are both sorted by their ...
1
vote
2answers
39 views

I need to reference the same two columns multiple times in where clause

I've got a table that stores survey question information and I'm looking to find out a count based on gender, race, etc My issue is that I have to reference the same columns multiple times in the ...
3
votes
1answer
88 views

Conditional selection in FROM clause

I have two tables: parent with columns identifier (pkey) and period; child with columns identifier (pkey), parent_identifier and period. There are additional columns, but I did not list them here as ...
1
vote
1answer
15 views

Is it possible to install a service pack to a SQL 2012 Express instance?

I have a SQL 2012 Express instance that is on Service Pack 3. I am trying to find a way to update it to Service Pack 4 but this doesn't seem to be possible or maybe I am just not finding the right ...
0
votes
0answers
19 views

Weekly and Biweekly Std Deviation for total rowcount by grouping parameteres

I am trying to calculate standard deviation according to 3 grouping columns System, Type, T_Type. The query should calculate weekly and biweekly deviation for row count according to above grouped ...
0
votes
1answer
23 views

How to change definition of a Postgres 12 GENERATED column

How to change definition of a Postgres 12 GENERATED column? CREATE TABLE test ( id serial PRIMARY KEY, val_a int4 NOT NULL DEFAULT 0, val_b int4 NOT NULL DEFAULT 0, val_sum int4 ...
0
votes
1answer
25 views

Is this the correct/best way to create a custom column in mysql?

I needed to select certain records from a selection with a custom column that have another column's modified value as its own value. The following query just works for my needs. But I wanted to know ...
0
votes
0answers
22 views

Theoretical options for syncing from a MASTER table to a COPY table?

I have a MASTER table and a COPY table in separate databases (both are Oracle 12c). I want to sync the MASTER table with the COPY table on a weekly basis. The goal is to keep the two tables exactly ...
0
votes
1answer
12 views

Switching context between two instances from one account

I have a server with two instances running on it (a dev environment) where we use one login to access either instance. I wanted to be able to switch context from one instance to the other without ...
2
votes
1answer
45 views

Azure SQL: Azure SQL Database traffic migration to newer Gateways

I have been assigned a task to look at this: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-gateway-migration. I got an email about it: I have a pretty standard setup, with a Azure ...
0
votes
0answers
15 views

MongoDB: Lost dry run election due to internal error

I am trying to solve a Replication issue here in MongoDB 4.2, but I can no longer get my Primary server back to primary, it always stays in SECONDARY mode. I've tried several types of solutions, like ...
0
votes
0answers
24 views

When does setting the SORT_IN_TEMPDB option actually improve performance? [duplicate]

My question is related to index rebuilding, mainly the SORT_IN_TEMPDB option. BOL states that: Even if other users are using the database and accessing separate disk addresses, the overall ...
0
votes
0answers
11 views

Data is not distributed across shards mongodb [on hold]

Have configured one config server with replication and three shards on replication. When sharding is enabled at database and collection level, then data is not distributed across shards in chunks. ...
0
votes
1answer
28 views

Postgres text column too large for an index - searching for IP address, so I don't think text search will work

I have a Postgres database with a column that has a large amount of text in it. There are potentially multiple IP addresses in the text, as well as a lot of other text. I need to do a query WHERE ...
0
votes
1answer
42 views

TIMESTAMP OR DateUpdate

I want to implement incremental ETL on some of my sql server tables, so I need a new column like UpdatedDate to track change dates of my records. I want to transfer only updated and inserted records, ...
1
vote
2answers
62 views

How to find unused logins in SQL Server?

I have a couple of databases on my server, each with its own users. Now I need to find and delete all those logins, which are not mapped to any user in any database. But I've also seen that it is ...
1
vote
0answers
24 views

MSSQL - Lock escalation on partitioned indexed view

I'm using partitioned tables where I set LOCK_ESCALATION to AUTO to prevent lock escalation to table level, but keep it on partition level. On the top of that table I have indexed view which is ...
1
vote
1answer
26 views

Postgres: Trigger always uses the same value for now()

I would like to create a trigger that keeps a last-updated time on each row. It would fire on CREATE and UPDATE, and store the current time into a column. I'm following basically the exact recipe from ...
0
votes
1answer
20 views

How to select from two tables where the rows may be or may not be equal and group it if they are equal

I have two mysql tables of images ojm_pages_articles_photos, ojm_images_optimized but I want to select rows that are common to them and also rows that are NOT common to them. In case common rows are ...
0
votes
4answers
35 views

How to terminate all DB usage of a PostgreSQL user

How to terminate all DB activities of a particular PostgreSQL user? I know how to select them: SELECT * FROM pg_stat_activity WHERE usename='foo_user'? And I found this here: https://stackoverflow....
0
votes
3answers
66 views

Query takes too much time to execute

I add the Query Plan of my query. And this takes too much time to execute and give data. https://explain.depesz.com/s/4JtZ I want to reduce the execution time of this query. So require to optimize ...
0
votes
1answer
34 views

Trying to run lines on a timer

One of the things I need to do on my job is run lines of SQL code. I need to do each line individually. Which involves highlighting one line, executing it, then doing the next. Sometimes it is up ...
0
votes
0answers
74 views

Should I move ORDER BY to app?

I noticed this discussion on NOT using ORDER BY in SQL query unless really necessary. https://www.brentozar.com/archive/2019/10/how-to-think-like-the-sql-server-engine-adding-an-order-by/amp/ The ...
1
vote
0answers
20 views

Does anyone deployed a succesful SSAS on docker?

I'm trying to create a docker image that contains MS SQL server, analysis services, and restore a db (bak) and a cube (abf). The Sql server part is the easy stuff, and I imagine that the restore will ...
0
votes
1answer
20 views

Is there a better ticketing system to check PostgreSQL issues?

I want to keep track of an issue in PostgreSQL. This mailing list tool that they have is hard. Is there an easier way to track their issues, open one and track it? Like a mirror system they have in ...
0
votes
0answers
15 views

Takes several hours to commit data on my data warehouse what seems for only one table

I have a data warehouse which runs several jobs during the night in order to update data. Background and job execution(s) setup One of these jobs updates the FactSale table consisting of the sales. ...
-1
votes
0answers
20 views

Sql server scheduler is trimming clob data [on hold]

We have a TSQL batch to move data from one oracle table to a table in sql server. When we run this batch manually, it works fine but when we run this batch by scheduler, clob data is getting trimmed. ...
0
votes
1answer
21 views

Will creating reports on R using MySQL Database update my database on MySQL?

I use MySQL to store my data. To analyze the data I want to be able to generate monthly reports on R. So far I was able to connect to MySQL using dbConnect but I want to make sure that none of the ...
0
votes
2answers
30 views

How to simulate bad backup file with 'ultraedit'

I want to simulate bad backup file with ultreadit, but I don't know how as I know nothing about ultreadit. Please help me with that. I simply want to make the SSMS fail to read the pages of a bad ...
1
vote
0answers
35 views

Database design - dogmatic view? [on hold]

I'm an application developer (full stack, I'm not shy of SQL, actually prefer it to some ORM solutions). The database architect (that has no coding role) for the project I'm working on is adamant ...
1
vote
1answer
48 views

How to create a DB Link to a Database which has failover in TNS

Could you please help me to understand how my DB LINK creation sql look like to a database (RAC env, Oracle 12c) which have fail over option in tns entry? I read below post from Oracle-(not having ...
0
votes
0answers
9 views

2 Relationships between same 2 entities

New database student here. I am having troubles understanding this case for ER to relational database conversion. So when mapping this to a database does the table for entity one look like this? ...
0
votes
1answer
16 views

Enforce unique constraint on 1 of n values

Let's say I have a table like this. create table foo ( id serial primary key, kind smallint not null check (kind >= 0 and kind < 3) ); With that check constraint, Postgres will only ...
0
votes
1answer
16 views

PostgreSQL query with subquery doesn't working as expected

I'm trying to make a query that should return records based on a subquery. Here's an example: select ... where tablename like ('%subquery_result%'); The subquery is generating the string as ...
0
votes
1answer
34 views

Database Consistency History fails in SQL Server 2017 Express

When I run the Database Consistency History report using MSSM I get an error message: unable to retrieve data for this section of the report. Following error occured Msg 19050, Level 16, State 5 ...
0
votes
1answer
16 views

Change value lower_case_table_names on a running docker container

I have a running docker image with a database where, for some reason, the columns are in camel-case. I have been searching how to change the value of lower_case_table_names to 1. How can I make this ...
3
votes
2answers
53 views

Way to obtain full list of column dependencies for stored procedure?

I've built a stored procedure (which we can call sproc_deps) that uses sys.sql_expression_dependencies and sys.dm_sql_referenced_entities. I want it to list out all of the tables and columns used by a ...
0
votes
0answers
22 views

SQL server move in LAN [closed]

I want to move SQL Server in my local server (LAN) ...A app is develop....When the app run on client side then the centralizer server response it.A simple form on client side query request to server .....
1
vote
1answer
19 views

How To Fix High DTU Usage on Specific Query

I have a query that runs every few seconds on a Microsoft SQL Azure Database. It is from a web job that checks if there are actions that need to be done based on rows in a specific table (its a ...
0
votes
1answer
77 views

Optimize Large Query Performance

I have this query that I can't seem to speed up at all. My running theory is that I need to fix some indexes or something. I am running the database through the Azure and that does auto indexes, so I ...
2
votes
1answer
89 views

How to rewrite CASE expression to short-circuit evaluation

I would like to know if there is any way to rewrite the EXPRESSION in the query (just expression, not the whole query) to short-circuit useless evaluation of THEN phase? Demo data: CREATE TABLE #...
0
votes
1answer
62 views

Worse query performance even after improving the query by making it to run in parallel mode

I have a SQL Query which gets generated from application using EFF. It uses a view and this view has joins to multiple tables in there. The query runs slow and when i looked at the execution plan,i ...
0
votes
2answers
35 views

pg_switch_wal In Point In Time Recovery PostgreSQL

I was following this tutorial about point in time recovery in postgres and come up with the following questions. Can anybody help me. Is it necessary to use pg_basebackup every time I want to back up ...
10
votes
1answer
629 views

How to check if a trigger fires on INSERT, UPDATE or DELETE statements?

How do I determine whether a trigger is targeting INSERT, UPDATE or DELETE statements? I've checked in sys.triggers and I can't see anything related to what operation the trigger fires on.

15 30 50 per page