2
votes
3answers
8k views

How to select the first 10 records for each table in the same database using sql

I have 50+ tables in a database. I don't want to use the following SQL on each table in a database. select * from {table_name} So, is it possible to display the first 10 records for each table ...
3
votes
2answers
2k views

What is the difference between using varchar(100) and varchar(255)?

I want to know difference between varchar(100) and varchar(255) in terms of memory usage and programming problems of using more memory.
3
votes
3answers
3k views

How to check for mutiple rows with same data?

Can anyone advise how do I check multiple rows with same data? E.g. I have 2 rows with following values: Cola Colb Colc TYPE_APPLE 123 abc Colb Colb Colc TYPE_APPLE 123 ...
0
votes
2answers
75 views

some tips on setting up sql server database server

I am currently setting up a new SQL Server database server with databases. It is supplied by a third party company. I need to request access for them around ports etc. I would like to be able ...
13
votes
2answers
36k views

What is the difference between optimize table and analyze table in mysql

What is the difference between optimize table and analyze table in mysql? I have read the online docs, but not sure what the difference is.
2
votes
0answers
2k views

Better query to select multiple columns into a single output column? [duplicate]

I have the following query that sort of works, but I find it to be kludgy and inefficient. Is there a better way to write this query? I know this is a bit of an odd query, else I would probably have ...
1
vote
3answers
2k views

psql asks for password, CREATE USER didn't specify one

I used to have a user, say 'jack' in postgresql, and then I forgot what the password. I reassigned all its ownerships to user postgres, removed the user, and then created it again with CREATE USER ...
0
votes
1answer
296 views

Maintenance in MYSQL when innodb_file_per_table disabled

I have read your post and I completely understand OPTIMIZE TABLE to perform in an environment where innodb_file_per_table is disabled, does not shrink the global ibdata1 tablespace. But what if I ...
30
votes
5answers
17k views

Why would I NOT use the SQL Server option “optimize for ad hoc workloads”?

I've been reading some great articles regarding SQL Server plan caching by Kimberly Tripp such as this one: http://www.sqlskills.com/blogs/kimberly/plan-cache-and-optimizing-for-adhoc-workloads/ Why ...
1
vote
2answers
5k views

Display user-defined types and their details

I've created a few new UDTs in PostgreSQL. However, now I have two problems: how to see which UDTs have been defined? how to see the columns defined within these UDTs? Unfortunately, I couldn't ...
0
votes
2answers
952 views

Is there a sortable ('order by') alternative to CURRENT_TIMESTAMP

I'm in the process of looking for a way to find a sortable alternative to a column that is populated with CURRENT_TIMESTAMP and I'm stumped at the moment. I have a web based form with multiple ...
1
vote
2answers
234 views

Suggestion for storing a lot of simple data

I'm looking to crawl a lot of webpages (500,000,000,000) records and be able to store the linking structure for a later date. The way I planned on laying out the database was as follows: 2 Tables ...
5
votes
1answer
163 views

SQL Server 2005 not collecting logins in the log file

I am currently running SQL Server 2005 Standard Edition on a Windows 2003 server machine. I have gone to the properties of the server and confirmed that the Login Auditing is set to both failed and ...
5
votes
1answer
129 views

How to tell if database tuning is fruitful (PostgreSQL)

As a DBA, I regularly observe my database, tune up some queries (either getting the programmers to re-write it or add index or update statistics if that's what is needed, etc). I also tune up the ...
0
votes
1answer
670 views

slow queries - set weight to token type in tsquery - postgresql

Postgresql version 9.2.3! I'm working on a database for mapping of chemical names. My main table contains aprox 91 million records and it's indexed by gin. I want to query it with multiple names (I'm ...
3
votes
1answer
68 views

Special ordering

I have a hierarchical query but I don't manage to order it as I want. I have a column named sequence that indicates how to order it but the data is kinda mixed up and I cant do it properly. This a ...
7
votes
2answers
1k views

Is there any difference between putting a column alias at the start or the end of the column definition?

I've always seen and written my column aliases as SELECT 1 as ColumnName but today came across a query that used SELECT ColumnName = 1 Is there any difference in how these two queries get ...
0
votes
1answer
526 views

Connecting to an SQL Azure Database from SSMS - IP Restriction

I am trying to connect to a new SQL Azure Database via SQL Server Management Studio. The client box running SSMS is hosted on a production DB so we restrict access on 1433 to just a handful of IPs ...
4
votes
2answers
1k views

What utilities can I use to simulate I/O load for a DB restore and DBCC check?

I'm trying to figure out the peak load I can sustain on new hardware I procured for validating backups and performing DBCC checks. I've been using Crystal Diskmark to get throughput stats which helped ...
2
votes
1answer
865 views

Pervasive linked server provider missing

I am having the same problem as this question. I installed Pervasive v11 (which does have 64bit ODBC drivers) and I still do not see Pervasive listed as a provider when trying to create a linked ...
1
vote
2answers
3k views

how to import mysql system “mysql” database [closed]

This question might be already answered but it's almost impossible to google it. When I perform full backup of mysql server using mysqldump --all-databases then reinstall it from scratch I want to ...
5
votes
3answers
165 views

Filtering data that could have more than one category

I have a table like the following: Annotation ( document, term, category ) Where document and term are some ID, while category is an integer. The couple document - term is not unique, ...
3
votes
1answer
2k views

How to tell what's failing at making backups?

I have an instance of SQL server that is regularly getting errors like this: 02/25/2013 23:22:38,spid138,Unknown,BackupVirtualDeviceFile::SendFileInfoBegin: failure on backup device ...
7
votes
1answer
1k views

Unrecognised system process saturating CPU

We have switched to our backup DC today as primary site Bandwidth has gone. We are getting issues with the most powerful DB server; it is spawning the following process for several db's on the ...
6
votes
1answer
10k views

SUPER privilege not defined for master user in Amazon MySQL RDS

I have created one medium instance on amazon rds in asia pecific (singapore) region. i have created my master user with master password. and it is working/connecting fine with workbench installed on ...
1
vote
2answers
65 views

Postgresql: type_modifier in UDT

In the manual for creating UDTs in postgresql I found the following statement: PostgreSQL allows user-defined types to take one or more simple constants or identifiers as modifiers. However, this ...
2
votes
3answers
20k views

How to use 2 auto increment columns in MySQL phpmyadmin

Is it possible to use 2 auto increment values ? One starting from 0 Another starting from 4000400 Please help me
1
vote
1answer
566 views

Sybase Databse Migration from 11.5 to 15

I have to migrate the Sybase Database from 11.5 version to 15. I would like to know few things mentioned below - i) What are the neccessary steps i need to follow in this migration. ii) What are the ...
1
vote
1answer
3k views

MySQL optimization

I'm trying to optimize a MySQL Server to be able to serve as many connections as it can. The server is in AmazonAWS RDS and has currently the following resources: --7.5 GB memory, 4 ECUs (2 ...
3
votes
2answers
2k views

Problem with order by in MySQL subquery

I'm running a query that runs in about 2 seconds when the subquery does not include the order by date_sold clause. However, when I add the order by clause, the query runs forever. I'm confused, since ...
4
votes
2answers
855 views

Reseed a newly created table

I have create a new table on SQL Server 2008. This table has an identity column, defined like this: [ID] [int] IDENTITY(1,1) NOT NULL However when I insert any data, the first record starts from ...
0
votes
2answers
910 views

Output count percentage in 2 decimal places

I have the following sql query code and I can not get to execute the desired output. SELECT Deal_type, Price_type, cast(sum(Deal_type)/count(Deal_type)*1.0 as decimal(12,2)) as results FROM ...
2
votes
1answer
535 views

Log all than queries taking more than X seconds

I have a database Microsoft SQL Server 2008r2. I have some applications in different programming languages. I would like to log all the queries that take more than X seconds. I guess that the I ...
1
vote
1answer
3k views

Is storing archive logs on local disk and backups on vendor storage possible?

I am using DB2 9.7. My LOGARCHMETH1 is set to VENDOR library. Example: LOGARCHMETH1=VENDOR:/usr/openv/netbackup/bin/nbdb2.sl64 Is it possible to call the following backup command: db2 backup ...
5
votes
1answer
2k views

Specifying the failover partner when using Availability Groups

We have a situation where we are using replicated databases in an environment that's making use of Availability Groups. As we wanted no manual intervention when failing over, we decided to set up ...
0
votes
1answer
169 views

Oracle ASM Backup Strategy

When the Full Backup (hot backup) happens and let us say it takes about 5-6 hours to complete. Then what about the Transactions that happen during the backup. Will it be recorded in the Backup file ...
5
votes
2answers
1k views

What are the advantages of a database design with single table for MtM relationships?

The database that backs our software product has a table design like the following: Positions ID Name Parts 1 One 12345 2 Two 12346 3 Three 12347 Collections ID ...
6
votes
2answers
9k views

How to refresh AD security group on Sql Server permissions

I am using Sql Server 2008 on Small Business Server 2003; client is using WinXP. I added a user to my Active Directory Security Group; Why can't this user immediately access the database? It seems ...
4
votes
2answers
6k views

Why is SQL Server memory showing in task manager

I have worked with SQL Server for a while now, and I understand that SQL memory is inaccurately reported by the task manager. However I have recently been doing some testing on SQL Server that ...
1
vote
1answer
448 views

Create a mysql slave database from master database

I have a mysql master database running. I want to have a slave database. So, I stopped the master mysql database and copied it to the slave machine. I had bin log enabled on master so even those files ...
1
vote
1answer
855 views

multi-master to single-slave replication at table level with PostgreSQL or MySQL

Here is my scenario Master1 hosting DB1 Master2 hosting DB2 ... MasterN hosting DBN replicate to: Slave1 hosting DB1,DB2... DBN I've read similar questions and they recommend to start different ...
7
votes
4answers
8k views

SQL Server - Separating data, log, and TempDB files on a SAN

I have a SQL Server connected to a SAN. Our new storage vendor recommends that all LUNs span the entire disk array, which is RAID5. I would normally request 3 separate LUNs (data, log, and TempDB) ...
0
votes
2answers
94 views

How to organize a single query to several sql servers?

I need to make an inner join sql query to several SQL Servers (one is 2000 and another is 2008 R2). The query is like the following: SELECT k.ID, k.NAME, k.BIRTH, l.PROFILEID FROM ...
1
vote
0answers
457 views

How to aggregate calculated measures involving dimension attributes?

The business case is as follows - I have a cube of sales transactions and a dimension of parts. One of the attributes of a part is the current cost, which is non-aggregatable. A user needs to model ...
2
votes
0answers
93 views

Stored Procedure Performance Issue

I have a stored procedure that is stalling the database. If the stored procedure is run as a query, the results arrive nearly instantly. If the stored procedure is run as a stored procedure, with it's ...
0
votes
1answer
77 views

Faster joining on 'most recent' related rows

I have a bug tracking application. The bug table stores very little, because every state change to a bug happens by adding a comment. For example, the current state of a bug is determined by the state ...
2
votes
1answer
2k views

Connecting to Oracle SQL Developer locally on Mac?

I'm trying to connect to Oracle SQL Developer locally on my Mac. How exactly is this done? I've looked all over the network, and can't find anything helpful. The only thing I did is installing the ...
4
votes
2answers
456 views

How to re-simulate a long query stuck in mysql queue?

BACKGROUND Occasionally, in my live web app, I'll get a query that locks up the database for 1-2 minutes. Sometimes it is hard to predict which queries will do this until the load gets to a certain ...
16
votes
1answer
15k views

Is there a graceful or safe restart for mysql like for apache httpd?

I would like to restart mysql gracefully just like httpd where threads are served before restart. I would dislike queries breaking.
5
votes
1answer
5k views

MySQL 5.6 on OS X 10.8.2 disconnects on user creation?

Via Homebrew I just upgraded from MySQL 5.5.29 to 5.6.10 and all my queries and existing users are working fine, but whenever I try to modify permissions or create users now MySQL disconnects me. Are ...

15 30 50 per page