Most Popular

1500 questions
21
votes
2 answers

Why not rebuild indexes with page count <1000?

I use Ola Hallengrens script for Index maintenance. Before I did that, I used the following query to see which indexes are fragmented most: SELECT dbschemas.[name] as 'Schema', dbtables.[name] as 'Table', dbindexes.[name] as…
user1261104
  • 405
  • 2
  • 4
  • 7
21
votes
2 answers

Rebuilding the transaction log

We have a very large database (~6TB), whose transaction log file was deleted (while SQL Server was shut down. We have tried: Detaching and reattaching the database; and Undeleting the transaction log file ...but nothing has worked so far. We are…
21
votes
8 answers

Professor told us to store serialized Java objects as blobs instead of defining relational tables

Instead of actually defining a tables with the correct attributes, my professor told us we could map objects to ids like this: id (int) | Serialized Object (blob) 1 10010110110 I can see so many problems with this; data…
Tyler Davis
  • 311
  • 1
  • 2
  • 6
21
votes
14 answers

Comfortable sqlplus interface?

I found sqlplus'interface is rather outdated. It's quite nice to have some commands or keywords at disposal, but for example no "arrow-up" key for the previous history entry is available. What is a good replacement / extension for sqlplus? Could be…
Sebastian Roth
  • 1,356
  • 3
  • 15
  • 23
21
votes
3 answers

Clustered columnstore indexes and foreign keys

I am performance tuning a data warehouse using indexes. I am fairly new to SQL Server 2014.Microsoft describes the following: "We view the clustered columnstore index as the standard for storing large data warehousing fact tables, and expect it…
OverflowStack
  • 439
  • 5
  • 9
21
votes
1 answer

PostgreSQL Common Table Expressions vs a temporary table?

The PostgreSQL documentation on WITH shows the following example: WITH regional_sales AS ( SELECT region, SUM(amount) AS total_sales FROM orders GROUP BY region ), top_regions AS ( SELECT region FROM…
Nathan Long
  • 885
  • 2
  • 9
  • 20
21
votes
1 answer

PostgreSQL - If I run multiple queries concurrently, under what circumstances would I see a speedup? Under what circumstances would I see a slowdown?

I approach you all humbly as one who is NOT a DBA, and I'm sure that my question is fraught with conceptual shortcomings and "it depends on" land mines. I'm also pretty sure that all of you who choose to answer are going to want a lot more in the…
Aaron Johnson
  • 313
  • 1
  • 2
  • 5
21
votes
4 answers

What's the most efficient UUID column type

For storing a 128 bits UUID there are multiple storage options: a byte[16] column two bigint/long(64 bits) columns a CHAR(36) column - 32 hex digits + 4 dashes. a UUID database specific column, if db supports it From an indexing point of view…
Vlad Mihalcea
  • 907
  • 3
  • 9
  • 22
21
votes
4 answers

How do you find SQL Server version/edition without SSMS installed?

How do find out which edition is installed without having the management studio installed? I have a server that functions as a license manager for another software. Upon investigation of a high RAM usage alert, I found that the sqlservr.exe…
AKDiscer
  • 1,385
  • 6
  • 27
  • 39
21
votes
2 answers

Postgres: How to insert row with autoincrement id

There is a Table "context". There is an autoincrement id "context_id". I am using sequence to retrieve the next value. SELECT nextval('context_context_id_seq') The result is: 1, 2, 3,...20.... But there are 24780 rows in the "context" table How can…
user3631472
  • 311
  • 1
  • 2
  • 3
21
votes
3 answers

Copy maintenance plans to a different server

Is there a way to copy maintenance plans from one SQL Server 2012 to another? Both servers are not accessible via the same copy of Management Studio at the same time (on different networks).
Greg Bala
  • 1,005
  • 3
  • 10
  • 19
21
votes
2 answers

Converting a VARCHAR to VARBINARY

I've been keeping a log of expensive running queries, along with their query plans, in a table to allow us to monitor trends in performance and identify areas that need optimising. However, it's come to the point where the query plans are taking up…
Mark Sinkinson
  • 10,547
  • 3
  • 46
  • 54
21
votes
3 answers

How to Log All mysql queries into log file?

I am using Mysql 5.6.12 under Wamp server environment. Now I want to log All queries into ".log" file, the queries which are running by PHP or from PHPMyAdmin, I want to log them...
Qazi
  • 313
  • 1
  • 2
  • 8
21
votes
1 answer

How to convert a unix time to PostgreSQL' Timstamp without timezome?

I have a PostgreSQL database running on a server which has its time zone set to India's Time Zone (i.e. UTC +5:30) I have some data in a table which is created like this: CREATE TABLE "CLOUDDATA" ( "CD_Tm_Obs" timestamp without time zone, …
Devdatta Tengshe
  • 621
  • 4
  • 9
  • 16
21
votes
7 answers

Script to see running jobs in SQL Server with Job Start Time

how to write script to see running jobs in SQL Server with Job Start Time? SELECT sj.name, sja.run_requested_date, CONVERT(VARCHAR(12), sja.stop_execution_date-sja.start_execution_date, 114) Duration FROM msdb.dbo.sysjobactivity sja INNER…
zerbug
  • 329
  • 1
  • 2
  • 4