Most Popular

1500 questions
20
votes
4 answers

Should I manually VACUUM my PostgreSQL database if autovacuum is turned on?

I use software which makes a big PostgreSQL database (there is a table with a million rows in it) and the developers says I should VACUUM and ANALYZE periodically. But the PostgreSQL database default is autovacuum turned on. Should I vacuum/analyze…
kissgyorgy
  • 325
  • 1
  • 3
  • 8
20
votes
4 answers

Is it better to separate a big query into multiple smaller queries?

There are situations which require having really big query joining several tables together with sub select statements in them to produce the desired results. My question is, should we consider using multiple smaller queries and bring the logical…
2hamed
  • 323
  • 1
  • 3
  • 7
20
votes
4 answers

Good, Bad or Indifferent: WHERE 1=1

Given this question on reddit, I cleaned up the query to point out where the issue was in the query. I use comma first and WHERE 1=1 to make modifying queries easier, so my queries generally end up like this: SELECT C.CompanyName …
WernerCD
  • 1,225
  • 3
  • 11
  • 19
20
votes
5 answers

Primary filegroup is full SQL Server 2008

I have a large table (~50 million rows) I'm trying to bulk insert into SQL Server and I get the error: Could not allocate space for object 'myDB' in database 'I 3 Stroke' because the 'PRIMARY' filegroup is full. Create disk space by deleting…
wootscootinboogie
  • 459
  • 2
  • 6
  • 14
20
votes
1 answer

Warning in query plan "Cardinality Estimate"

create table T(ID int identity primary key) insert into T default values insert into T default values go select cast(ID as varchar(10)) as ID from T where ID = 1 The query above has a warning in the query plan.
Mikael Eriksson
  • 22,175
  • 5
  • 59
  • 103
20
votes
4 answers

Cannot shutdown old postmaster when upgrading to Postgres 9.2

I'm upgrading to Postgres 9.2.2 (from 9.1.4). When I try to upgrade the DBs using: pg_upgrade -b /usr/local/Cellar/postgresql/9.1.4/bin -B /usr/local/Cellar/postgresql/9.2.2/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres I get the…
Luciano
  • 1,671
  • 3
  • 12
  • 8
20
votes
5 answers

Best cloud platform for PostgreSQL

Currently, in our project, we use dedicated servers for our PostgreSQL database. In theory, we can run anything on some cloud platforms. However, PostgreSQL configuration is strictly related to hardware configuration. What we are looking for is a…
Vlad Minaev
  • 301
  • 1
  • 2
  • 4
20
votes
4 answers

How can I backup a large SQL Server database without impacting performance?

We've had reports of queries running slowly or timing out early in the morning, and the only job I see running that I think could affect this is our database backup job. The database itself is about 300GB, and the backup job starts at 4:30am and…
Rachel
  • 8,477
  • 20
  • 50
  • 74
20
votes
2 answers

SQL Server in-memory optmized tempdb metadata memory usage continually growing

Problem We have enabled sp_configure 'tempdb metadata memory-optimized' = 1, and now the tempdb meta data is taking over 400 GB on one of our servers and continues to grow. There are some drops in memory usage, but generally it keeps growing it's…
SQLing4ever
  • 488
  • 3
  • 8
20
votes
5 answers

Download SQL Server Profiler for SQL Server Management Studio

How can I profile a SQL Server 2008 database to see code that's being executed on a particular database? I remember using the SQL Server profiler, but I don't see it in SQL Server Management Studio after downloading SQL Server 2008 R2 Express. …
JustBeingHelpful
  • 2,082
  • 18
  • 45
  • 60
20
votes
3 answers

Set "lock wait timeout" in MySQL

Where would I set the maximum time a query will wait for a lock in MySQL 5.0.68 before timing out?
Gaius
  • 11,200
  • 3
  • 31
  • 64
20
votes
2 answers

Why does DELETE leave a lingering effect on performance?

At the end is a test script for comparing the performance between a @table variable and a #temp table. I think I've set it up correctly - the performance timings are taken outside of the DELETE/TRUNCATE commands. The results that I am getting are…
孔夫子
  • 4,330
  • 3
  • 29
  • 49
20
votes
1 answer

What factors go into an Indexed View's Clustered Index being selected?

Briefly What factors go into they query optimizer's selection of an indexed view's index? For me, indexed views seem to defy what I understand about how the Optimizer picks indexes. I've seen this asked before, but the OP wasn't too well received.…
EBarr
  • 690
  • 6
  • 13
20
votes
3 answers

SQL Server - Select most recent record from each group when performance is critical

I run a SQL Server 2016 database where I have the following table with 100+ millions rows: StationId | ParameterId | DateTime | Value 1 | 2 | 2020-02-04 15:00:000 | 5.20 1 | 2 | 2020-02-04 14:00:000 |…
20
votes
2 answers

During a log backup is the data backed up to the start or end of the operation?

Say I am running a log backup, and that log backup takes 10 minutes to complete. During that 10 minute window, further transactions are run. Given the below example, which transactions does the log backup actually contain? Transaction A…
George.Palacios
  • 5,540
  • 21
  • 48