1
vote
2answers
284 views

postgresql sticking “enable_seqscan=False” in a UDF sensible?

I have a query which is taking 40 seconds to execute over the 80ms that it should if postgres where to filter off the primary key rather than doing a sequential scan. I have to force postgres to ...
3
votes
1answer
3k views

Sql server 2008 R2 installation fails with Error: 17204

Sql server 2008 R2 installation fails with the below error message in the log message, This is a part of the sql server log Starting up database 'msdb'. Error: 17204, Severity: 16, State: 1. ...
4
votes
1answer
544 views

How to I interleave logs from two different Oracle tables?

I have two log tables, which are populated from two different PL/SQL packages. It's often useful to keep the data separate, but sometimes I'd like to "interleave" the two tables so I can see what's ...
3
votes
1answer
92 views

SQL Server Analysis Services - where do I store user logins?

If I would like to create a Business Intelligence (BI) system using SSAS, with SSRS getting data from the SSAS cube. Which would be the best possible option to store users' credentials used with ...
2
votes
1answer
1k views

LEFT JOIN / WHERE clause with is null and false Estimated Number Of Rows

I have a table named Product and a table named ProductPropertiesCountry. Product is the definition of a product (description, price, productId, etc) ProductPropertiesCountry contains restrictions on ...
0
votes
1answer
57 views

Why $in is much faster then $all

I am well aware of what those 2 do. $in take .3 seconds. And $all take 26 seconds. Huge different. If anything $in should take longer because it returns more data. Also if the limit is removed, $in ...
1
vote
1answer
472 views

MySQL to add to cart 1-4 Socket Server

When I check for price tags for MySQL, I see a clause called "1-4 socket server" or "5+ Socket Server".. what does this mean? "Socket" in generic term means Inter Communication Protocol. For MySQL, ...
8
votes
3answers
2k views

Does SSRS lock the table when querying?

My senior DBA told me that SQL Query execution by default doesn't lock the table. I was having some issues with my SQL Server Reporting Services (SSRS) report which seems to be getting some issues ...
2
votes
2answers
7k views

PostgreSQL hardware reguirements

What is the memory/cpu/other requirements to run PostgreSQL database server efficiently ? Is a way to appoint a hardware configuration for some sort of requirements - for example number of users, ...
2
votes
2answers
530 views

Replacing composite key with surrogate

I have the following table that has a couple of million rows in it and is 99% fragmented virtually all of the time. My plan was to insert a IDENTITY field as a surrogate key to replace the current ...
0
votes
2answers
1k views

limit and then group by in MySQL

I have a mysql table having following structure : payment_id(int auto_increment), emp_id(int), chargeTime(datetime), payment(double) I need to have three latest (with respect to chargeTime) ...
2
votes
3answers
728 views

How to select data in a sub query only once?

I have the following query: SELECT ordno from orders where ordno NOT IN (SELECT ordno FROM invoices) There are about 25000 records in each table. I have indexed the ordno column. The query ...
4
votes
2answers
2k views

WHERE clause is not filtering on LESS THAN and GREATER THAN or BETWEEN

I am trying to select MTR values that are between the values of 0 and 4. What am I doing wrong? SELECT DATEDIFF(M, TheDate, TheOtherDate) AS MTR FROM MyTable WHERE MyID = 2074163 AND MTR >= 0 ...
2
votes
1answer
94 views

Count total where owner_user_id = some_value and deleted_by_owner = 0 or to_user_id = some_value and deleted_by_to = 0

I didn't know if this is possible using just a query or if I need some procedural logic on this one. I have this table: CREATE TABLE `default_messages_users` ( `id` int(11) NOT NULL ...
5
votes
2answers
3k views

SQL Server Agent not observing “execute as” permissions

I have a curious permissions problem. Something recently happened that caused existing SQL Server Agent Jobs that were configured to run as a particular User to stop working. They previously worked; ...
2
votes
1answer
410 views

Creating the database on different file groups

What is the pros and cons of creating the database for a operational system on different file groups? I know it is useful if you want to keep the static part of a database online when the other part ...
0
votes
0answers
201 views

How to load XML data into an oracle db table?

Is there a way to load the XML format data into an Oracle 11g DB table directly ? Can we write a stored procedure to accomplish the same in a more efficient way with the best performance? Can we ...
4
votes
1answer
2k views

Does the Amazon RDS backup/snapshot service lock tables?

We have a database that is 100+GB. Most tables use the InnoDB engine. A regular dump takes 1-2 hours. If we moved to Amazon RDS, would this backup cause table locks? Does Amazon use a simple ...
5
votes
2answers
199 views

Web Database - How to store user information

I'm starting to design a database to use in a web solution and would like to understand if there is any benefit to storing passwords (and the rest of the user information for that matter) in a ...
2
votes
1answer
108 views

Question about new behavior of current connection combobox in SQL Server 2012

I have a question about the new behavior of the database selection combobox in SQL Server 2012 (Press Ctrl + U to move your focus to it). It seems that, unlike in SQL Server 2008 R2, clicking in the ...
4
votes
1answer
1k views

Alternatives to AdeptSQL Diff (for MS SQL Server 2012)

It seems AdeptSQL Diff is not compatible with SQL Server 2012 (at this time). And it is my preferred tool for deploying changes. I realize this is a shopping list but I hope SE won't mind. I am ...
4
votes
1answer
3k views

Retrieve XML of large plan from plan cache

I'm trying to view (graphically) a large query plan that is in the plan cache and am running into problems where the XML is truncated in the query results. This is the query I'm using: SELECT TOP 1 ...
4
votes
2answers
4k views

Query two SQL Server databases in same function but on two different servers

Suppose I have two database servers (DB-SERVER-1 & DB-SERVER-2), and there is a single database on each server (DB1 & DB2). Both are SQL Server databases. Is it possible to query both ...
3
votes
1answer
3k views

Enabling Service Broker on a database involved in an availability group

I'm trying to enable Service Broker on a SQL Server 2012 database that is part of an availability group and keep getting this error message: The operation cannot be performed on database "dbname" ...
3
votes
1answer
437 views

Surrogate key / Primary key: Better to use an existing unique data field or create a key field?

I am not sure if this question has been asked or not. At least I couldn't find it. I am curious about a primary key in terms of efficiency with data searching and retrieval. This is a hypothetical ...
2
votes
2answers
3k views

Oracle - abort within a “before insert” trigger without throwing an exception

I know that this is an awful thing to do for many reasons, but I am in Get Things Done mode and we have a piece of software, which we can't modify, that writes records to a table. Some of these ...
8
votes
1answer
1k views

Friends relations in MySQL

I'm developing a friendship relation in MySQL where friend relation is mutual. If A is friend of B, then B is friend of A. If one of the users end friendship then relation drops. I want to learn which ...
3
votes
2answers
2k views

Can you time how long an Oracle import takes?

I'm on a Windows machine with Oracle Client 11.1.0, and am going to import a database dump. I'm importing from the command line with the "imp" command. Is there an option to time how long the import ...
4
votes
2answers
497 views

T-SQL Syntax error copying views dynamically

I'm creating a stored procedure to copy all views from one database to another using the following code. ALTER PROCEDURE [dbo].[spCreateViews] (@SourceDB NVARCHAR(200), @DestinationDB ...
14
votes
1answer
11k views

Scalability limitations of PostgreSQL and MySQL

I've heard that performance of non-sharded relational database such as MySQL or PostgreSQL "breaks" beyond 10 TB. I suspect that limits as such do exist as one would not come up with Netezza, ...
1
vote
1answer
72 views

Deadline rule date input after now

Hi I'm trying to find a way to ensure deadlines inputted are later than the current time and date. Currently I'm attempting this with a rule. CREATE OR REPLACE RULE "DeadlineInput" AS ON INSERT ...
5
votes
1answer
302 views

Prevent users deleting more than a certain number of rows in MySQL

The problem: I have a table with rows, nothing special about it When a database user removes a row, it should increment a number A database user is only allowed to remove 3 rows max in the table A ...
1
vote
2answers
2k views

Too many TIME_WAIT connections in PostgreSQL

I am using PostgreSQL 9.0 on Centos 5.7 Final. At any given there are around 1,500-2,200 connections open for PostgreSQL on port 5432 which are in TIME_WAIT state. I have a feeling this is not good. ...
7
votes
2answers
2k views

MySQL : perform a big data migration between tables

I want to migrate data between 2 InnoDB tables. Currently I'm running this query: INSERT INTO table_a SELECT * FROM table_b; If the dataset grows, what's the best way to avoid CPU overload? ...
1
vote
1answer
1k views

SQL Server connection from iis website: “error: 26 - Error Locating Server/Instance Specified”

I've just moved all my databases from one server to another clustered server. The new SQL Server 2008 R2 (enterprise edition) install is using named instances on a non-standard port. SQL is running ...
2
votes
2answers
4k views

User Defined Function Return value

Hello all I have a function: ALTER FUNCTION [dbo].[getContentURL] ( @VID int, @accountID int ) RETURNS VARCHAR(500) AS BEGIN DECLARE @cTable varchar(50) = ...
2
votes
2answers
180 views

Visual Studio DAC with Schemabound View containing hierarchyid::GetRoot() - Two part name needed?

In Visual Studio, when trying to create a DAC which has a schemabound view which contains hierarchyid::GetRoot() this error is generated and the project does not build. However, the t-sql is ok as if ...
4
votes
2answers
9k views

How do I get the current and next greater value in one select?

I have a InnoDB table 'idtimes' (MySQL 5.0.22-log) with columns `id` int(11) NOT NULL, `time` int(20) NOT NULL, [...] with a compound unique key UNIQUE KEY `id_time` (`id`,`time`) so there can ...
2
votes
1answer
1k views

Postgresql WAL Archiving, How to do it properly?

Basically I have one (for now) mission critical postgresql database that I will need up to the minute recovery for, I've never implemented a working WAL archival before so I would like to know what is ...
4
votes
2answers
538 views

Updating data from a report: any potential pitfalls?

Question: In general, are there any pitfalls with updating data from a SSRS report?* Context: More specific, I'm talking about this context: SSRS 2008 (with the option to upgrade, if needed). ...
3
votes
1answer
267 views

Reset the numbering at the tabs of the Microsoft SQL Server Management Studio

I notice there are some numbering on the tab of each new query (such as the number 52, 56, 57 and 58 as shown in the following pictures) What does these numbers means and is it possible to reset to ...
2
votes
2answers
2k views

EXECUTE sp_executesql

i have a problem with EXECUTE sp_executesql and stuck with it. my query is as follows DECLARE @TABLE_NAME VARCHAR(5)='#T' DECLARE @TABLE_ID INTEGER=0 DECLARE @QRY NVARCHAR(MAX) ='' ...
2
votes
1answer
2k views

How to modify a stored procedure using SQLCMD for MS SQL?

Suppose a stored procedure as follows have been created using the Microsoft SQL Management Studio. use testbase go create procedure testtable_pricesmaller @pricelimit money as select * from ...
4
votes
1answer
32k views

How to create a trigger that update the date field and time field upon modify of the row?

I have created a table testtable inside the database testbase that have the following structure: product_no (int, not null) product_name (varchar(30), not null) price (money, null) expire_date (date, ...
7
votes
4answers
31k views

"Could not find stored procedure' even though the stored procedure have been created in MS SQL Server Management Studio

I have created a table testtable inside the database testbase that have the following structure: product_no (int, not null) product_name (varchar(30), not null) price (money, null) expire_date (date, ...
1
vote
1answer
958 views

Can operations in a loop cause table locks?

I know a bit about locking etc, that when a transaction is working on a table, if it is altering a certain amount of data it might try and lock the entire table (I'm sure that is over simplified, but ...
3
votes
3answers
4k views

MySQL: selecting arbitrarily ordered rows after a specific id

Please excuse the awkward wording of my title, I'm not quite sure how to phrase what I'm asking. Suppose I have a table like this: id value 1 10 2 40 3 20 4 50 5 40 Running this query: ...
2
votes
2answers
2k views

Oracle regular expression regexp_like

I have simple question. why would : select regexp_like( (select 'https://www.hotmail.com' from dual) ,'(f|ht)tps?:') from dual ; not work?
0
votes
1answer
2k views

Db design for a quiz with variable number of answer choices, and each worth different score in a different category?

I'm working on a question/answer project and having a hard time coming up with a suitable database structure. Each question can have from 1 - "n" answers, and each answer is associated with one of ...
5
votes
3answers
2k views

Maximum number of databases for single instance of PostgreSQL 9

Developing a multicustomer application we plan to use a different database for each customer. But it could be more than 1000 customers (applications). Will PostgreSQL handle it without any problems? ...

15 30 50 per page