Most Popular
1500 questions
24
votes
4 answers
What does horizontal scaling mean?
In database context, I have come across horizontal scalability as one of the advantages of the NOSQL databases. What does the term mean?
CouchDB on Wikipedia
NoSQL on Wikipedia
How would it compare to vertical scaling?
Lazer
- 3,351
- 15
- 42
- 53
24
votes
3 answers
How to select specific rows if a column exists or all rows if a column doesn't
I'm writing a script that gets a count of rows for a few tables, however for some tables I want to only get a count of rows where a flag is set (in this case active=1). Is there a way I can do this in one query?
Eg:
Table users has a column called…
Matt S.
- 343
- 1
- 2
- 6
24
votes
1 answer
How to use transactions with SQL Server DDL?
I have a login table into which all inserts are done by a single stored procedure.
CREATE TABLE dbo.LogTable(
LogRefnr int IDENTITY(1, 1) NOT NULL,
LogQuery varchar(255) NOT NULL,
LogTime datetime NOT NULL,
logQueryDuration int…
bernd_k
- 12,211
- 23
- 75
- 111
24
votes
1 answer
Find all the queries executed recently on a database
[I am a beginner level T-SQL Programmer]
[..and hopefully I am on the right stack exchange site]
I would like to get a list of all the queries I executed (in the least, those I executed today since morning). I need to make a report on the execution…
Prashanth Tilleti
- 373
- 1
- 2
- 6
24
votes
4 answers
Choosing the right algorithm in HashBytes function
We need to create hash value of nvarchar data for comparison purposes. There are multiple hash algorithms available in T-SQL, but which one the best to choose from in this scenario?
We want to ensure the risk of having duplicate hash value for two…
Sky
- 3,684
- 16
- 49
- 68
24
votes
2 answers
How to keep history of SQL Server stored procedure revisions
Note: I am not asking about full version control.
Is there any way automatically to keep a history of stored procedures on SQL Server.
Similar to how Google Docs automatically keeps a history of versions of documents and Wikipedia automatically…
cja
- 365
- 2
- 4
- 10
24
votes
1 answer
Is there a good way to run a trigger for each record in a postgres table?
I have a system where I can't control the design of some tables (replicated via Slony-I), and so I have a series of what we refer to as 'shadow tables', where I extract some information out of the replicated tables, and store it in the processed…
Joe
- 5,149
- 1
- 28
- 39
24
votes
3 answers
Is there a common pattern for storing many boolean flags other than adding a ton of columns?
I have a bunch of booleans I need to associate with user accounts. They need to be toggled true and false, though not particularly frequently - they're going to be read more often than they're written. Most commonly they'll just be set from False to…
rococo
- 419
- 4
- 8
24
votes
3 answers
Why would a table with a Clustered Columnstore Index have many open rowgroups?
I was experiencing some performance issues with a query yesterday and upon further investigation, I noticed what I believe is odd behavior with a clustered columnstore index that I'm trying to get to the bottom of.
The table is
CREATE TABLE…
Taryn
- 9,676
- 3
- 45
- 74
24
votes
2 answers
Trigger: move deleted rows to archive table
I have a small (~10 rows) table called restrictions in my PostgreSQL database, where values are deleted and inserted on a daily basis.
I would like to have a table called restrictions_deleted, where every row that is deleted from restrictions will…
Adam Matan
- 11,659
- 29
- 80
- 95
24
votes
7 answers
Could not find the Server Agent in SSMS
I am following the guide - http://www.sqlchicken.com/2009/07/how-to-create-a-server-side-trace-with-sql-profiler/ which is working until I reach Step 8
Now to schedule your newly created script. In SSMS connect to the server you want to trace on.…
Jack
- 2,509
- 14
- 36
- 42
24
votes
2 answers
Should I use the PostgreSQL bit string?
I've been learning about the bit string data type lately, and I am quite curious about:
At the bottom of this doc page there is the sentence:
... plus 5 or 8 bytes overhead depending on the length of the string
How are bit strings handled in…
Jackey Cheung
- 391
- 2
- 3
- 6
24
votes
4 answers
Can I change table structure in a transaction and then roll it back if there is an error?
I have some ALTER TABLE statements that I am running. Not all of them work (they are the result of running SQL Data Compare) and I want to group them in some transactions and roll back the statements if something goes wrong.
Is this possible, or is…
Piers Karsenbarg
- 949
- 2
- 11
- 23
24
votes
2 answers
PostgreSQL procedural languages - differences between PL/pgSQL and SQL
Can anybody please summarize the differences between:
http://www.postgresql.org/docs/9.1/static/xfunc-sql.html
and
http://www.postgresql.org/docs/9.1/static/plpgsql.html
?
Main points:
conceptional differences
given a problem family, convenience…
Gismo Ranas
- 355
- 3
- 9
24
votes
4 answers
Easy way to check connectivity to SQL Server from client
For troubleshooting purposes, I would like to be able to check if a client can connect to a SQL Server instance, independent of the application that possibly can't connect to the SQL Server.
Is there an easy way (that means, not having to install…
MicSim
- 2,481
- 1
- 26
- 26