0
votes
0answers
4 views

Compare values between columns in different tables

I have two tables that looks exactly the same: CREATE TABLE `_sync_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `object_name` varchar(45) DEFAULT NULL, `sync_time` datetime DEFAULT NULL, ...
1
vote
0answers
6 views

Move database from windows server 2003 to windows 7/8?

I am working with this company currently running their SQL Express database in a virtualized Windows Server 2003. What would you experts say about replacing that for a virtualized slimmed-down ...
1
vote
0answers
16 views

Caching impression counts to avoid mysql inserts

We currently get a LOT of mySQL inserts/updates on duplicate daily (millions) and we're looking at speeding up the application by using some form of counter with memcached and then clearing it on ...
1
vote
0answers
2 views

Caching impression counts to avoid mysql inserts

We currently get a lot of mySQL inserts/updates on duplicate daily (millions) and we're looking at speeding up the application by using some form of counter with memcached and then clearing it on ...
-1
votes
0answers
22 views

HAVING Clause syntax question

Can a sum be computed using a case statement inside the HAVING clause of a query? something similar to this: GROUP BY id HAVING SUM(CASE WHEN date1 BETWEEN DATE_SUB(date2, INTERVAL 30 DAY) AND ...
1
vote
0answers
27 views

Denormalization vs Cached Data [on hold]

I'm in a dilemma about denormalization of the database vs. caching the joint query results of the database. We have 2 tables. Let's say A and B. A may have many of Bs but B can be belong to only one ...
3
votes
0answers
13 views

Complete deadlock on PostgreSQL 9.3 after removing a numeric id

The problem - complete DB lock after a schema change Architecture I use a PostgreSQL 9.3 with PostGIS to store location updates. The updates are written to two tables - location_updates and ...
1
vote
0answers
18 views

How to store data of the subcategories table with different coloumns for each subcategory table for Products?

I'm new to database designing. I'll use MySQL and PHP. I'm designing a database in which I have a lot of category and subcategory like given below: Product Table p_id p_title category_id F ...
0
votes
0answers
15 views

Tables not updating and deleting the entries

I am facing the below problem on updating the tables ROW OPERATIONS -------------- 0 queries inside InnoDB, 0 queries in queue 3 read views open inside InnoDB Main thread process no. 2376, id ...
0
votes
0answers
13 views

Performance Issue on Centos Server (Mysql)

I have performance issue on my centos server (vps). I asked about it in serverfault and I was said there is a problem with mysql and ask here. Here is serverfault topic, you can find details. ...
2
votes
1answer
77 views

Database Backup - In Process - Power Outage

I am using SQL Server 2008 R2. What happens if a database backup (Full/Differential/Transaction Log) is in process and there is a sudden power outage or the system crashes? Does that corrupt the ...
0
votes
0answers
6 views

Access 2007 reforming field formation

In student database I have a form which has drop down option for defining the class or level of a student. this field was set as options: Grade 1, Grade 2, Grade 3 and so on. Many students entries ...
0
votes
0answers
20 views

Query Designer - Cannot connect to Server

I am following a tutorial to be able to use SQL Server Data Tools (SSDT) for reporting. However, I am having issues connecting to a particular database when I try to add a new DataSet and try to ...
-1
votes
1answer
15 views

Mysql: How does a rollback operation be performed inside InnoDB

I would like to hear in simple words Please answer me in simple words to the question on the below scenario. ============== Engine: Innodb Trx1 : started and a DML is executed at 10:00 AM and rolled ...
-2
votes
0answers
11 views

Does CHECKDB require database to be locked for data Entry in SQL Server 2000? [on hold]

As I see it, the DBCC CHECKDB('DBName', REPAIR_ALLOW_DATA_LOSS) TSQL command requires changing the DB to single-user mode with this command: ALTER DATABASE DB SET SINGLE_USER Then why does ...
2
votes
1answer
59 views

select n values per group

Lets say I have the following table ----------------------------- | user_id | comment | ----------------------------- | 2 | thats cool | | 2 | awesome | | 3 ...
1
vote
1answer
7 views

Postgres streaming replication between hosts with different timezone

I am running Postgres 9.1 on Windows 2012 servers. I am using postgres's streaming replication to replicate data between 2 servers. It has so happened that the time zone of the slave has not been set ...
1
vote
1answer
16 views

Pausing the import of an SQL file in Postgresql?

I am currently importing a large database (6 - 7 GB's) into my postgresql on Ubuntu. It's taking sometime to do. A problem has come up where I need to physically relocate the laptop the postgresql is ...
0
votes
0answers
20 views

Need to make sure database is fully normalised and all is accessible using MySQL and Java EE

So as per the picture: I need to create the roster table with all the data from the connecting ones - Each Roster entry will have the country,state and city, tech and subtech and client. Then ...
0
votes
0answers
17 views

SQL Server can not save Autogrowth changes

When I have change Enable Autogrowth checkbox (set to true) and save it (Ok) And when I go back to the Change Autogrowth for ..... I see that the changes have not been saved. SQL Server 2008R2 (I go ...
-1
votes
0answers
9 views

Error encountered during replication [on hold]

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
31 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
33 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 ...
3
votes
1answer
64 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
38 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
40 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
23 views

View of structurally same tables [on hold]

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
26 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
52 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
1answer
45 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
28 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
2answers
19 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
27 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
28 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
15 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
19 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' [on hold]

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
34 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
30 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
72 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
16 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
19 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
28 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
24 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 (*) ...

15 30 50 per page