0
votes
0answers
7 views

Error encountered during replication

During replication i deleted the physical files of database which was in recovery state now it is in recoverypending state so how i can delete it
1
vote
0answers
21 views

Get average of multiple rows with criteria and return those rows

I'm attempting to get any items that are the same type, but are ranked one higher that have an average equal or greater than the item ranked below. I have a table and query like ...
1
vote
1answer
28 views

Speed up COUNT(*) when using an index

I have a table similar to this (simplified): CREATE TABLE books ( id INT AUTO_INCREMENT, category INT NOT NULL, PRIMARY KEY (id), KEY (category) ); This table has over 10,000,000 ...
1
vote
0answers
26 views

A costly approach to filtering on a calculated date

This builds off my previously wonderfully answered question Running a complex query for every date in a range I've got an expanded problem and I'm certainly not solving it in a performant way. The ...
0
votes
2answers
28 views

How many passes of a table are done with UNION ALL? [on hold]

I am trying to run a single query that will make a single pass through a table, and was wondering if by using UNION ALL to make counts of total row unioned with counts of unique rows so I would be ...
2
votes
1answer
28 views

Migrate existing SQL Server database file to smaller files

I have a database that is about 1TB in size. It's currently on a 2TB hard drive and I would like to replace it with a few 512GB SSD. I need to split the existing database file (.mdf) into multiple ...
2
votes
0answers
18 views

View of structurally same tables

Let's say I have two schemas (HR and Finance for example), in each schema I have a table with information about document types this department works with. Tables have the same structure: HR.doc_type ...
0
votes
0answers
21 views

Metrics for performance of Oracle

I am trying to measure various metrics for a stored procedure - that we are tinkering with and using under different loading (i.e. size of tables). So I have drawn up this list of metrics to plot ...
3
votes
2answers
47 views

Use a view to join tables or a stored procedure for a better execution plan?

First let me state I am a C# developer, not a SQL Server DBA, so please excuse my ignorance on SQL Server database query execution plans. What I want to know is for a stored procedure which the ...
1
vote
2answers
36 views

Delete rows where matched value is twice as much

I'm trying to match two tables with two columns, table1 and table2. Each has id and price columns. I want the query to match each id and compare the price, then delete the row if the price in the ...
1
vote
1answer
27 views

Three-sided many-to-many relationship design

I have 3 table that have a relation to each other. My tables are: OPTION PLAN PRICE Relationships: PLAN and OPTION has is a many-to-many relationship OPTION and PLAN has many-to-many relation ...
1
vote
0answers
18 views

How to sort new data for display? [migrated]

I am new to SQL. I have a table called Categories with 3 columns: id int(25) category varchar(25) subcategory varchar(25) I would like to add a new subcategory "Real Estate Agency" in the category ...
0
votes
1answer
12 views

What is happening when Seconds_Behind_Master oscillates between two very different sets ov values?

I have a Percona 5.6 slave, newly set up, that is replicating from a server that is itself a slave to a third. The middle server (dbS2, the master for dbS3) is currently ~260000 seconds behind the ...
1
vote
3answers
26 views

Selecting the average of the top percent of duration, grouped by minute

I am attempting to find the average of (the top 5% of duration/ per minute). I wrote this query: select AVG(Q.duration) Avg5Perc, Q.time FROM ( select top 5 PERCENT duration, time from ...
1
vote
2answers
26 views

Generating a sequence of values

How can I change 2,2,2,1,2 into 201,202,203,101,204 in MySQL? I have a table with data in the format of: +---+---+---+ | U | C | R | +---+---+---+ | 1 | 2 | 1 | | 1 | 2 | 2 | | 1 | 2 | 3 | | 1 | 1 | ...
0
votes
0answers
11 views

There is no option of audit in security for SQL Server 2014 .How to enable audit option for same?

Please see the below image there is no option about audit in database
1
vote
0answers
19 views

SQL Server Performance in VMWare when creating different drives from a single Datastore [on hold]

On VMWare if you are going to create a new SQL Server instance with 4 processors / 32GB ram as an example GuestOS and I have access to storage that is just one a big giant 800GB "Datastore" (made up ...
2
votes
0answers
17 views

SSIS Update (Replace) record instead of append based on Primary Key

I created an SSIS Pacakge that imports a monthly extract claims file. I have a simple Data Flow task, flat file to OLEDB Destination with a Derived column component in between used to generate a ...
1
vote
0answers
17 views

SSIS Error - Login Failed for user 'sa'

I am running an SSIS package. However, I get the below error... The ExistsOnSQLServer method has encountered OLE DB error code 0x80040E4D (Login failed for user 'sa'.). The SQL statement issued ...
2
votes
0answers
17 views

How to examine PostgreSQL server's SSL certificate?

Suppose there is a PostgreSQL server running and it has SSL enabled. Using "standard" Linux and PostgreSQL tools, how can I examine its SSL certificate? I'm hoping for output similar to what you ...
1
vote
2answers
35 views

Is smallest to largest the rule of thumb in a multi-table JOIN?

Given this query, SELECT a.* FROM a LEFT JOIN b ON b.a_id = a.id LEFT JOIN c ON c.a_id = a.id HAVING COUNT(DISTINCT b.id) < COUNT(DISTINCT c.id) if b is a significantly larger table than c, will ...
0
votes
0answers
33 views

Stored Procedure to create 1 row in parent table and multiple rows in child table [on hold]

I'm trying to create a stored procedure that creates a parent record and then multiple child records. I've kept the columns basic for this. Table 1 has columns: tbl1.EmployeeID tbl1.contractID ...
0
votes
1answer
14 views

Error 1241 When Calculating Percentages

I am trying to get my percentages to equal 100%. As of right now they far surpass 100%. I need to account for the percentages in two different tables, ua_money_allocation and ua_expenses_by_school. ...
2
votes
1answer
27 views

Three tables joined by a many-to-many relationship?

I'm working on creating a db model for the following requirements: I have many Types that have many different Statuses. Depending on the Type and Status, the Status can have certain SubStatuses. So ...
4
votes
1answer
70 views

When to use sort_in_tempdb when rebuilding indexes?

We are debating whether to use the SORT_IN_TEMPDB option for our DW tables. My understanding is that there are more writes when using this option, although they are more sequential. We have a SAN ...
0
votes
0answers
15 views

How to get Business days per month between two dates?

I need to get the total Business Days Per MONTH between 2 dates. I would like to incorporate a Holidays table too. For Example, @StartDate = '12/26/2013' @EndDate ='03/19/2014' I need the ...
0
votes
0answers
12 views

How can I associate different not done continuation blocks with two cursors in the same scope?

If I have two cursors declared in the same block, how can I associate different not done continuation handler actions that are independent of one another and only execute with the cursor they're ...
2
votes
0answers
18 views

Connection Pools and TempDB Internal Objects

I am thinking I know the basics of the problem here, but I want to make sure I know the details before trying to explain it to others. We recently upgraded our third party application software to a ...
-1
votes
1answer
24 views

Using datediff() in SQL Server 2008 to get the difference [on hold]

I'm having some trouble in updating my table. I would like to update the records that is passed in the current date. I am trying to update the records of the reservations(check-out) that is finished. ...
2
votes
1answer
23 views

How to write a query that counts rows by date?

I have a database named emp1. There is a table named tx_feeder. I want to get the count of rows from that table. I have used the following query to get the data of single day, select count (*) ...
0
votes
1answer
8 views

mysqlbinlog: unknown variable ssl_key or ssl_cert or ssl_ca

I am trying to recover binlog from a remote server using mysqlbinlog client program, however it appears that mysqlbinlog doesn't recognize the SSL options that's required to establish SSL connect to ...
1
vote
0answers
20 views

How do you output field changes in mysql the most efficiently?

I have a rather large employee feed coming in and each employee has about 50 fields. I take the employee data and add on a bunch of other stuff and this gets outputted to one of our vendors. Most ...
1
vote
0answers
15 views

Select records where difference between datetime column1 and column 2 is greater than X amount of time

As the title indicates, I'm trying to return records where the datetime difference between two datetime columns is greater than X amount of time. I'm having trouble wrapping my head around this ...
0
votes
0answers
19 views

Creating a trigger to update field in 1 table based on values in another table using data in multiple rows

I'm new at SQL and need to create 2 triggers between 2 tables. Table 1 has the following columns: tbl1.ContractID char(6) tbl1.ContractFulfilled char(1) Table 2 has the following columns: ...
0
votes
0answers
14 views

Strange Intermittent Postgres Performance Issue (docker?)

I am running a local Postgres 9.3 in a docker container with a temporary database that is used for some file import operations. The basic scenario is: Load files into input tables INSERT from a ...
3
votes
0answers
23 views

Very high transactions per second

Our production server runs on average 4,000 transactions per second. In the past few days the average has jumped to 175,000 transactions per second. That is not a typo, it's 175K per sec. Looking at ...
2
votes
0answers
23 views

SQL Server replication - error when creating a subscription - The article '(null)' does not exist

When trying to add a subscription to an existing publication use [Product] exec sp_addsubscription @publication = N'Product', @subscriber = N'REPLON1', @destination_db = ...
2
votes
3answers
100 views

Selecting records where date range is current year minus #years

I want to select and eventually delete records from a point in time earlier than current year minus "x" years. I'm unsure of the most efficient way to do this.
1
vote
2answers
45 views

Create rows when selected rows exist

I haven't spent much time with SQL Server, and I can't seem to figure something out. I have 3 tables; user, usergroup, group. usergroup is a table that contains both a group id and a user id, where ...
2
votes
1answer
21 views

Recover mysql using data folder

One of our MySQL servers died but somehow we were able to recover all the files from it. This server was a slave at one time however we stopped it being a slave so we could use it for housekeeping ...
0
votes
1answer
26 views

How should I handle unknown primary keys? [on hold]

I'm working as a database-administrator at a school. Recently the school upgraded its pupil administrative software into a web-based solution. This works great, but this web-based solution is missing ...
0
votes
1answer
23 views

SQL server data copy bug? [on hold]

I have one query who shows some data, and those data I'm manually copying to Table1. The query shows the numeric type and it is in this form Query +---------------+ | status ...
1
vote
1answer
13 views

Use of smallserial gives error with PostgreSQL

I know the very basics of databases. I worked in the past with MySQL and recently switched to PostgreSQL (9.1) with PostGIS 2.0.1. At the moment I'm designing a new database and I use the tool ...
0
votes
1answer
14 views

How to find queries that timed out in MongoDB?

Is it possible to find queries in the system.profile-Collection of a MongoDB-database that did not finish due to a timeout? I found some queries that ran longer than the time specified in $maxTimeMS. ...
0
votes
0answers
19 views

Synchronise Oracle Tables to SQL Server

Our ERP is using an Oracle database while our BI system is based on SQL Server. We need to get the changed data in Oracle and copy it in our staging area. At the moment we get the changed rows by ...
-1
votes
1answer
17 views

T-SQL Trying to create a trigger that uses joins across 2 server instances [on hold]

I am trying to complete a trigger on 2 instances of SQL Server. I am running MS Dynamics ERP set CRM & GP. I need to remove data from one server once an update happens to another table. I have ...
0
votes
1answer
11 views

MobiLink: How to add a new table to synchronisation using Sybase Central and mlagent

How to add a new table to a synchronisation using mlagent configured from Sybase Central. This might be related to this or this question. When doing a change on remote database as described on ...
1
vote
0answers
21 views

Postgres - Error while adding constraints

Can anyone tell me what this error is? And How to resolve it? ERROR: could not read block 27651 in file "base/114689/118316": read only 4096 of 8192 bytes CONTEXT: SQL statement "SELECT ...
1
vote
1answer
13 views

Innobackupex: How to extract individual files from xbstream compressed backups

We are scripting a mix of full and incremental backup setup for our prodcut backend with sunday triggering full backup and incremental backup on all the remaining days. In this process, we should be ...
0
votes
1answer
20 views

sql server replication - how to find and drop subscriptions?

I had 2 subscriptions to a publication, but they were from the same subscriber server and writing to the same subscriber database, just one was bad and one was running fine. I could not find a ...

15 30 50 per page