Most Popular
1500 questions
20
votes
7 answers
Does a DBA need to know how to program in a system language besides SQL?
To what extent does a Database Administrator need to know system or application level programming languages (for example .NET or PHP) besides "just SQL"?
For the purposes of this question, no specific version of the SQL standard is considered for…
p mac
- 201
- 1
- 2
- 3
20
votes
2 answers
Why these characters are all equal in SQL Server?
I just don't get it. See this SQL query:
select nchar(65217) -- ﻁ
select nchar(65218) -- ﻂ
select nchar(65219) -- ﻃ
select nchar(65220) -- ﻄ
if nchar(65217) = nchar(65218)
print 'equal'
if nchar(65217) = nchar(65219)
print 'equal'
if…
Saeed Neamati
- 1,427
- 3
- 18
- 32
19
votes
6 answers
Oracle Creating ER Diagrams and Data Dictionaries
I am new to Oracle Databases and would like to develop a data dictionary and ER Diagrams for our existing databases. Do you have any tips, scripts, tools for doing so?
Scott
- 657
- 4
- 8
- 15
19
votes
1 answer
Postgres: check disk space taken by materialized view?
I know how to check the size of indexes and tables in Postgres (I'm using version 9.4):
SELECT
relname AS objectname,
relkind AS objecttype,
reltuples AS "#entries", pg_size_pretty(relpages::bigint*8*1024) AS size
FROM pg_class
WHERE…
Richard
- 333
- 1
- 4
- 11
19
votes
1 answer
Empty Strings: Why or when is '' equal to ' '?
Who can explain why
select case when '' = ' ' then 1 else 0 end, LEN(''), LEN(' '), DATALENGTH(''), DATALENGTH(' ');
yields
----------- ----------- ----------- ----------- -----------
1 0 0 0 1
The funny…
bernd_k
- 12,211
- 23
- 75
- 111
19
votes
2 answers
Why did creating this new index improve performance so much when existing index included all columns in new index?
I have Log and LogItem tables; I'm writing a query to grab some data from both. There are thousands of Logs and each Log can have up to 125 LogItems
The query in question is complicated so I'm skipping it (if someone thinks it's important I can…
Nate
- 1,687
- 4
- 22
- 33
19
votes
4 answers
NVARCHAR column as PRIMARY KEY or as UNIQUE column
I'm developing a SQL Server 2012 database and I have a doubt about nvarchar columns as primary keys.
I have this table:
CREATE TABLE [dbo].[CODES]
(
[ID_CODE] [bigint] IDENTITY(1,1) NOT NULL,
[CODE_LEVEL] [tinyint] NOT NULL,
[CODE]…
VansFannel
- 1,853
- 5
- 23
- 36
19
votes
2 answers
Difference between row-based and statement-based replication in MySQL?
What is the actual difference between row-based and statement-based replication. I am actually looking in terms of replication's effect on the slave.
If I am using row-based replication then what is the effect on the slave and if I am using…
Abdul Manaf
- 9,677
- 16
- 71
- 84
19
votes
2 answers
Paging performance with customizable sorting over many millions of rows
In our application we have a grid where users can page over a large number of records (10-20 million). The grid supports sorting in ascending and descending order in a number of columns (20+). Many of the values are also not unique and so the…
Justin
- 920
- 1
- 7
- 11
19
votes
9 answers
How can I make MySQL client read password from mylogin.cnf?
I'm trying to make the mysql client connect to a mysql server without requiring the password to be given interactively.
Steps taken:
1) First create a mylogin.cnf file
$ mysql_config_editor set --user= --password --host=
Enter…
Lefteris Koutsoloukas
- 368
- 1
- 3
- 9
19
votes
3 answers
Cascade primary key update to all referencing foreign keys
Is it possible to update a primary key column value with cascading the update among all the foreign keys referencing it ?
# EDIT 1:
When I run followinq query
select * from sys.foreign_keys where referenced_object_id=OBJECT_ID('myTable')
, I…
mounaim
- 649
- 5
- 13
- 26
19
votes
4 answers
SQL Server Max Memory not limiting use of RAM
I would like your input on this. I have a sql server 2008r2 Ent. Ed. 64bit with 16 cores and 64GB RAM. There is one instance of SQL server patched fully as of 20111014.
The max ram is set to 60000MB. Amount of free ram is 0 according to task manager…
Martin Sjöberg
- 673
- 1
- 6
- 12
19
votes
1 answer
How to index a query with `WHERE field IS NULL`?
I have a table with lots of inserts, setting one of the fields (uploaded_at) to NULL. Then a periodic task selects all the tuples WHERE uploaded_at IS NULL, processes them and updates, setting uploaded_at to current date.
How should I index the…
Kirill Zaitsev
- 293
- 1
- 2
- 7
19
votes
4 answers
One Big Database vs. Several Smaller Ones
We have a situation were we can (A) deploy instances of an applications in one MySQL database using table prefixing or (B) use different MySQL databases for each instance of the application, for e.g.,
Setup "A":
central_database
app1_table1
…
KM.
- 1,357
- 4
- 14
- 20
19
votes
1 answer
PostgreSQL : drop column from view
I have a VIEW where I'm attempting to create an evolution script for, so I can add a column to it. That part works fine; column added just fine. However, the reverse does not work; remove that last added column fails with a ERROR: cannot drop…
Yanick Rochon
- 1,591
- 4
- 19
- 28