dialog
listlengths
4
30
title
stringlengths
15
150
category
stringclasses
14 values
dialog_time
stringdate
2016-01-21 01:59:30
2018-07-01 01:34:46
[ { "message": "I execute a statement in SSMS like:<pre><code>select Ident from PART_Stamm where VerketteterArtikelID = 'D9FA5CEC-E3C5-11E6-B088-F079596E5F58'</code></pre>There I can show the execution plan. This works perfectly. Now I need to also show the number of locks acquired on table <code>PART_Stamm</code...
Number of locks acquired during query execution
dba
2017-09-22T14:51:13.937
[ { "message": "There is a DBCC command to shrink files of a database. Unless the files are almost empty or the free space is nearly unfragmented this command is often refered as 'don't use'. In rare cases I need to shrink files to a new size. An alternative to the DBCC command in this szenario is what I am looki...
How to shrink big database files faster than dbcc command?
dba
2017-09-22T15:02:53.563
[ { "message": "Why is this so tricky, what is token set to that it isn't equal to null nor an empty string?<pre><code>SELECT lexemesFROM ts_debug('This is a title')WHERE alias = 'asciiword'; lexemes --------- {} {} {} {titl}(4 rows)</code></pre>Ok.. So I want to get rid of <code>{}</code>,<pre><code>SELECT lexem...
How do I select arrays that are not empty?
dba
2017-09-23T04:11:45.060
[ { "message": "I have two tables members and fees ,fees table has a foreign key memberid which is a primary key in members .I want to get those members who have not yet paid. When a member pays there are two fields fromdate and todate and both they are datetime.So those fields helps us to know that the member pa...
How to get latest date from fees table and compare it to current date in mysql
dba
2017-09-23T18:40:51.883
[ { "message": "I have two tables members and fees ,fees table has a foreign key memberid which is a primary key in members .I want to get those members who have not yet paid. When a member pays there are two fields fromdate and todate and both they are datetime.So those fields helps us to know that the member pa...
How to get latest date from fees table and compare it to current date in mysql
dba
2017-09-23T18:40:51.883
[ { "message": "I have a table with schema along the lines of:<pre><code>CREATE TABLE table1( account VARCHAR(64) NOT NULL, json JSONB NOT NULL);</code></pre>And I'd like to create an index on it that will allow me to run queries such as:<pre><code>SELECT *FROM table1WHERE account = :account AND json ...
Postgres GIN index on (VARCHAR, JSONB)
dba
2017-09-23T19:05:26.047
[ { "message": "I run a php site with mysqli. I got 3551496 Connections, but there were only 30 processes How can It beWhat should I do about it?The server is up for 6 month, The problem is that I keep getting too many connections error<a href=\"https://i.stack.imgur.com/atiN6.png\" rel=\"nofollow noreferrer\"><a...
mysqli large amount of connections
dba
2017-09-24T06:33:32.867
[ { "message": "We have recently had an issue where the transaction log grew and maxed out the storage space. This happened during a maintenance window (Ola Hallengren index Optimize scripts are being used.) For some reason, someone in the past has set the transaction log backups to stop for 3 hours, it seems to...
Is there any reason to stop transaction log backups during a maintenance window?
dba
2017-09-24T22:07:01.453
[ { "message": "We have recently had an issue where the transaction log grew and maxed out the storage space. This happened during a maintenance window (Ola Hallengren index Optimize scripts are being used.) For some reason, someone in the past has set the transaction log backups to stop for 3 hours, it seems to...
Is there any reason to stop transaction log backups during a maintenance window?
dba
2017-09-24T22:07:01.453
[ { "message": "I know how to debug a particular slow query with <code>explain analyze</code> (PostgreSQL).If I received vague \"DB is slow\" feelings, I worked with this answer: <a href=\"https://stackoverflow.com/a/12818168/633961\">https://stackoverflow.com/a/12818168/633961In my case there are no sequence sca...
PostgreSQL: From vague "DB is slow" to concrete actions
dba
2017-09-25T12:47:13.640
[ { "message": "I am at a new position and I am being told to implement a stored procedure that will accept a list of user ids and update a flag.When I suggested the use of a table value parameter (array emulation), I was told to implement as demonstrated below, as this is how it's been done before. I'm not a DB...
Proper use of varbinary type in MS SQL Server
dba
2017-09-26T00:30:00.763
[ { "message": "On my production SQL Server Enterprise Edition database 2014, I am trying to find why data files (.mdf) growing day by day.I get the following report From Management Studio: right click on the database> reports > standard reports > disk usage by top tables. I found some tables contain more than 70...
Can I Compress a huge table on SQL?
dba
2017-09-26T07:52:31.787
[ { "message": "What is the difference when speaking about 'LOB' and 'binary' data? Is it the same, in terms of binary data being stored in a separate filegroup, or are there differences?", "role": "user" }, { "message": "According to <a href=\"https://technet.microsoft.com/en-us/library/ms187752(v=sq...
What is the difference between LOB and binary data in SQL Server?
dba
2017-09-26T10:10:43.530
[ { "message": "When I try to log into the mysql shell with:<pre><code>mysql -u root</code></pre>then I get:<pre><code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)</code></pre>How do I log onto the mysql shell?I have been googling this left and right and...
Can't log into mysql shell
dba
2017-09-26T16:33:59.903
[ { "message": "I have three different kinds of products i.e., vehicle, gold and property in our application. Each product has almost 30 different kind of its own inventory details. I have designed my table structure as below:-Header Table:-<pre><code> PkId ------ + ProductFkId------ + AssetId ------ + RegNo 1 ...
Which kind of table design best suitable for normalization in SQL server?
dba
2017-09-26T18:24:17.470
[ { "message": "I'm working with a colleague who's proposed to split our 1 instance-database into about 7 databases (divided by data domain) for development and 7 identical databases for production. I get the test-production duality logic, but in what case or what advantages are there to splitting our 1, relative...
What are the main reasons to split a Data Warehouse into multiple databases?
dba
2017-09-26T19:58:44.273
[ { "message": "I'm working with a colleague who's proposed to split our 1 instance-database into about 7 databases (divided by data domain) for development and 7 identical databases for production. I get the test-production duality logic, but in what case or what advantages are there to splitting our 1, relative...
What are the main reasons to split a Data Warehouse into multiple databases?
dba
2017-09-26T19:58:44.273
[ { "message": "I followed below steps after SQL Server and Integration Services, but I am still getting an error.I added SQL service account in Microsoft SQL Server Integration Services 13.0 properties which is under DCOM Config, and granted remote permissions to both service account and dba group account under ...
SSIS 2016 Access Denied
dba
2017-09-26T22:42:00.307
[ { "message": "I have a problem with the following query:<pre><code>SELECT t1.idcliente, c.nombre,c.apellido, t1.fecha, t1.haber, t1.debe, SUM(t2.haber -t2.debe) as SUMFROM estado_cliente t1INNER JOIN estado_cliente t2 ON t1.idestado_cliente &gt;= t2.idestado_cli...
How can I get this "rolling total" query to sum correctly?
dba
2017-09-27T03:31:05.770
[ { "message": "Scenario:Windows Server 2012R2 &amp; SQL Server 2014 SP2, no CUs FCI adding a non-default port and keeping the default portI made the change on both nodes via SQL Configuration Manager, however, neither failover or complete resource restart allows a connection to be made on the new port. We have ...
SQL Server 2014 FCI Add Port
dba
2017-09-27T13:08:17.317
[ { "message": "Context: CU10 failed, reporting a corrupt master db when applied to SQL Server 2012 SP3 CU5. We built an empty new master on that server and will restore the backup of the CU5 master into a new CU5 instance on a different server. Now we need to replicate all settings from the restored CU5 master ...
What is a good script or free/trial tool to inventory/replicate all settings in master db?
dba
2017-09-27T16:29:52.637
[ { "message": "The other day I noticed something strange that perhaps someone have an explanation for. The problem I was facing was a query that due to a skewed distribution of data generated a poor plan when a parameter marker was used. The execution time was prox 10 times higher compared to a hardcoded value c...
Optimization profile and explain mode?
dba
2017-09-28T07:44:46.597
[ { "message": "I am developing an Excel / VBA - Application that connects to an Oracle database (v 11.2.0.4) instance. I need to query a customers table and search by name. Customers names will contain german umlaut chars (äöüÄÖÜ and ß). I issue sql queries like \"... where c.custname = 'Müller'\".The behaviour ...
Oracle driver and language specific chars
dba
2017-09-28T08:19:27.357
[ { "message": "After receiving some <a href=\"https://dba.stackexchange.com/questions/187044/disk-space-unreleased-after-cleaning-up-rows-from-pg-table\">insightful guidance in a previous post here, I'm going to run <code>VACUUM FULL</code> on 4 PostgreSQL 9.3.10 tables. Table sizes are:1) <code>links_publicrepl...
Time taken by VACUUM FULL to reclaim space
dba
2017-09-28T15:24:24.837
[ { "message": "Only user database on instance is ~8.5GBs.MAX Mem set to 16GBs, which is ALL being consumed.Virtual server has 24GBs RAM and 2 vcpusInsert Poltergeist meme \"What's happening?!\"***Side notes****2 vcpus have low avg utilization(&lt;50%).Server hosts app (using ~500MBs of RAM).Indexes are rebuilt b...
SQL Server '12 Using RAM equal to 2x size of the only user database
dba
2017-09-28T15:54:59.700
[ { "message": "I would like to have a query that obtains the same info as in the Disk Usage report, section data/Log files autogrowth/autoshrink events<a href=\"https://i.stack.imgur.com/CALXW.jpg\" rel=\"nofollow noreferrer\">I would like to build a custom monitoring report but i could not find where this repor...
Disk Usage Report SSMS - query to obtain same info
dba
2017-09-28T17:21:29.697
[ { "message": "I'm to transfer a postgresql 9.3.10 DB (~55GB) from Azure VM to an AWS EC2. Being a novice, this question is about getting the process right. I've seen <a href=\"https://dba.stackexchange.com/questions/86386/how-do-i-use-pg-dump-and-pg-restore-to-move-a-large-database-to-another-machine\">this pos...
Getting pg_dump and pg_restore right for postgresl (9.3.10)
dba
2017-09-28T18:40:28.690
[ { "message": "Ok, so I have a non-stored-procedure query that we're using in an SSRS report. This query has been hellishly slow (I've had the original version of this query running for the past two hours, still not done), in an effort to improve it I rewrote it from scratch, and I came up with the following:Now...
Why does this OPTIMIZE FOR UNKNOWN improve my query by several seconds?
dba
2017-09-28T21:02:55.330
[ { "message": "I have a query that I want to save as a view because it will be used on a different system that we don't have access to. The query basically gets running balances on debit and credit columns from a table.The query works fine,here is the query<pre><code>SELECT id,deb_id,trans_date,trans_ref,dr,cr, ...
MySQL having variable in view
dba
2017-09-29T13:10:05.607
[ { "message": "I have three different tables and I need to count how many rows has a specific value (<code>COUNT(track)</code>) then group by <code>tracks.id</code> and sort by only one result per user (<code>tracks.uid</code>).My three tables:<pre><code>`users`+--------+-------------------+| `idu` | `username`...
MySQL group by multiple columns on multiple tables only one result per group
dba
2017-10-01T11:29:19.860
[ { "message": "This is a follow-up to what I read on <a href=\"https://dba.stackexchange.com/questions/186778/is-there-any-reason-to-stop-transaction-log-backups-during-a-maintenance-window/186782#comment362868_186782\">Is there any reason to stop transaction log backups during a maintenance window? in the answe...
How to best manage Index Builds with Stats Updates?
dba
2017-10-02T23:19:46.580
[ { "message": "My question is an extension to <a href=\"https://dba.stackexchange.com/questions/181954/cpu-usage-alert-is-not-working-for-alert-if-counter-raises-above\">this. We have SQL Server Agent alerts(Deadlocks, Network IO etc) to monitor SQL Server performance. So i would like to write an alert for CPU i...
Cpu-Alert in SQL Server -2012 standard edition
dba
2017-10-03T07:26:26.587
[ { "message": "A server I administer recently experienced a power outage that caused issues with the SSRS <code>ReportServerTempDB</code>. After the outage, the nightly job that runs Ola's <code>DatabaseIntegriyCheck</code> started reporting problems:<pre><code>sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d Master -Q ...
BACKUP WITH CHECKSUM works but DBCC CHECKDB detects problems
dba
2017-10-03T20:30:12.587
[ { "message": "background info a php script is feeding the mysql table.I could do it manually, but am hoping for at least some kind of automation.<pre><code>1 12342 64 02 12347 65 03 11364 66 04 12281 67 05 12342 68 06 12347 69 07 11314 70 123478 2922 ...
Analyzing 126 columns for patterns to create similiar tables to avoid storing lots of NULLS
dba
2017-10-04T03:06:30.163
[ { "message": "I am running a project using Mongo DB and Django, I have 2 separate instance for my Django project and database each 16GB ram t2xlarge ubuntu ec2 instances.I am facing issue that within a day or two usage memory on DB server goes above 6GB and on app server it remains below 1GB but freezes applica...
Mongo DB Memory Utilisation freezes app needs restart
dba
2017-10-04T06:13:02.050
[ { "message": "I have a table that I want to convert to memory optimized.<br>I have 160 million rows in my table. According to <a href=\"https://docs.microsoft.com/en-us/sql/relational-databases/in-memory-oltp/estimate-memory-requirements-for-memory-optimized-tables\" rel=\"nofollow noreferrer\">this topic my ta...
SQL Server In-Memory Table Conversion
dba
2017-10-04T11:59:01.023
[ { "message": "When I try to <code>CREATE Script</code> on a database I want to use, there is no <code>CREATE Script</code> item in the context menu.<a href=\"https://i.stack.imgur.com/an4a0.png\" rel=\"nofollow noreferrer\">But <code>CREATE Script</code> looks fine on another database. I can select it and it wo...
pgAdmin 4 - Can't Create Script on a database
dba
2017-10-05T10:15:58.953
[ { "message": "I have a mongo shards cluster and a mongos instance. These servers are running on MongoDB 3.4.0. When I use mongo shell 3.4.0 to connect to the mongos, I got below output from <code>sh.isBalancerRunning()</code>,<pre><code>mongos&gt; sh.isBalancerRunning()false</code></pre>but I got a different re...
Mongo shell 3.2 has different results on sh.isBalancerRunning() as mongo shell 3.4
dba
2017-10-05T22:31:50.423
[ { "message": "Hi all I would like to apply one patch(pg_dump_grouplock.patch) in my PostgreSQL 9.2 database regarding lock table issue advised on below link <a href=\"http://www.postgresql-archive.org/pg-dump-and-thousands-of-schemas-td5709766i40.html\" rel=\"nofollow noreferrer\">http://www.postgresql-archive....
How to apply patch on postgresql 9.2
dba
2017-10-06T04:40:42.207
[ { "message": "I have the problem:<blockquote> Find all the customers that have an order that was handled by employee number 129 and count all the orders they made.</blockquote>What I tried: <pre><code>select c.id, c.fname, count(*)from customer c inner join sales_order so on c.id = so.cust_id group by c.id, c....
About "having" in SQL
dba
2017-10-07T11:32:56.090
[ { "message": "I have an app called 'Links' where 1) users congregate in groups and add others, 2) post content for each other in the said groups. Groups are defined by a <code>links_group</code> table in my postgresql 9.6.5 DB, whereas the replies they post in these are defined by a <code>links_reply</code> tab...
Optimizing slow performance of simple SELECT query
dba
2017-10-07T13:02:28.760
[ { "message": "I am new to MySQL. I installed MySQL through dmg file downloaded from oracle in mac. I created my first connection also but now whenever I am trying to connect it again it not allowing me. I read over internet that I need to <code>ALTER</code> root password. So I tried many ways of doing it but ei...
MySql Cannot connect after installation
dba
2017-10-08T08:40:37.147
[ { "message": "We have bunch of SQL Server 2012 Standard and SQL Server 2014 Standard database instances running on Windows 2012, each have different storage and memory. We are getting:<blockquote> Error Code: 802; There is insufficient memory available in the buffer pool.</blockquote>from 3 database servers w...
SQL Server 2012/2014 insufficient memory available in the buffer pool
dba
2017-10-09T16:31:51.307
[ { "message": "Even though, I've searched couple of them online but still looking if there is a better way to manage the SQL server backups, almost across 250 servers.Issue is we are not allowed sysadmin login to be created on one server to pull this report from.Please suggest a link or way to view the health re...
Centralized Backup report for SQL server databases
dba
2017-10-09T20:46:46.200
[ { "message": "I have a somewhat involved query that splits strings and outputs each word as a record.I did a quick test, one with a CTE and one with a subquery and was somewhat surprised to see that the CTE takes twice as long to execute.Here is the gist of what the query does:<pre><code>-- 1. translate matches...
Why is Postgres CTE slower than subquery?
dba
2017-10-10T11:02:50.967
[ { "message": "I plan on using the <code>IndexOptimize</code> script by Ola Hallengren to replace the SharePoint 2013 On Premise Defragmentation Timer Job. Anyone out there using it for this purpose? What params do you use and how? Here is what I put together to target the databases that the OOOTB Timer job woul...
Ola Hallengren Parameters for Index Rebuild/Reorganize on SharePoint
dba
2017-10-10T13:57:59.937
[ { "message": "I have implemented Always Encrypted feature in SQL Server 2016. The CMK is valid for one year. How do I renew it, or extend the validity?", "role": "user" }, { "message": "Always encrypted does not check for validity of the CMK certificate explicitly. Always Encrypted treats the CMK ce...
How to renew or extend the CMK Certificate in Always Encrypted feature?
dba
2017-10-10T15:16:48.937
[ { "message": "I've been tracking a bug in how single quotes/apostrohpes are handled in an application, and I've found a suspect in a database trigger.That trigger contains code like this: (shortened and anonymized)<pre><code>insert into logTable ([NewRowData]) select (select isnull(convert(nvarchar(max), [Foo...
Can this SQL cause unclosed quotation mark?
dba
2017-10-11T09:09:29.630
[ { "message": "I am facing an issue with DB mail functionality. I am using SQL Server Agent to trigger mail on success or failure. While sending this, I am also providing an attachment, which consists of some query-generated report.The problem here is I am able to send mail with attachment but the attachment siz...
DB mail sending attachment of size 64 KB only even after increasing maximum file size limit
dba
2017-10-12T04:40:12.163
[ { "message": "I think I am confusing things.In ETL, data conversion starts at Database A and ends up in Database B, both are relational databases. Maybe I have a 20-year-old system. I use ETL to get the data between the two databases. I do not know what else ETL is used for.In ELT, is that the same except th...
Does ELT data end up in an RDBMS?
dba
2017-10-12T16:26:05.530
[ { "message": "I think I am confusing things.In ETL, data conversion starts at Database A and ends up in Database B, both are relational databases. Maybe I have a 20-year-old system. I use ETL to get the data between the two databases. I do not know what else ETL is used for.In ELT, is that the same except th...
Does ELT data end up in an RDBMS?
dba
2017-10-12T16:26:05.530
[ { "message": "I have been passed a SQL Server 2014 backup that needs to be imported onto one of my SQL Server 2008 R2 servers. The backup is valid as I can restore it onto one of Dev 2014 SQL servers.I have done the script out task and that works fine for the most part. However one issue I face is that the SQL ...
"Cannot find data type" restoring a SQL Server 2014 backup on SQL Server 2008 R2
dba
2017-10-13T07:47:52.753
[ { "message": "In the MongoDB shell, how to views all documents in a particular collection for the current database that I'm using?when i am trying through the query <pre><code>&gt; db.getCollection().find()</code></pre>To getting the error as mention below <pre><code>2017-10-14T00:57:34.363+0530 E QUERY [thr...
How to views all documents in a particular collection of database in MongoDB through mongo Shell?
dba
2017-10-13T19:08:34.420
[ { "message": "I have 3 \"large\" tables that join on a pair of columns (both <code>int</code>s).Table1 has ~200 million rowsTable2 has ~1.5 million rowsTable3 has ~6 million rowsEach table has a clustered index on <code>Key1</code>, <code>Key2</code>, and then one more column. <code>Key1</code> has low cardinal...
How to hint many-to-many join in SQL Server?
dba
2017-10-13T22:08:02.057
[ { "message": "Database : Postgres 9.6 Use case : I have a function that needs to be hidden, only a particular role/user can see it. I don't even want to expose even the name or body of function to other users/roles. For example if I have a user named <code>test1</code> then he should not have any knowledge of ...
How to completely hide a function from all other users and roles?
dba
2017-10-14T08:31:23.333
[ { "message": "I've had sp_BlizFirst running for a few days every 12 minutes to capture the various statistics.What I've come to realise though is that it doesn't seem to gather a lot of File Related Performance Stats apart from I/O stalls.Is there enough info to make a decision on whether I/O is a problem or no...
sp_BlitzFirst - File Stats Interpretation
dba
2017-10-15T04:10:36.843
[ { "message": "I have a table with an id column which is auto-incremented, and various other informational columns. Rows are inserted into this table very frequently. When the data is read back, the majority of queries filter by a foreign key and a date range.Currently, there is a clustered index on the id colum...
How does clustering on a field other than autoincrement id affect inserts?
dba
2017-10-16T03:19:18.953
[ { "message": "According to this <a href=\"https://docs.microsoft.com/en-us/azure/sql-database/sql-database-automated-backups\" rel=\"noreferrer\">article, an Azure SQL backup can be used to \"Restore a database to another geographical region. This allows you to recover from a geographic disaster when you cannot...
Azure SQL Database Restore after Server Failure - Where are the Backups?
dba
2017-10-16T12:25:08.000
[ { "message": "I have multiple database sessions from which one has been blocking others because of a frozen application. There are transactions running on multiple sessions. I need to kill the head blocker because of Lock request timeouts on other sessions. After killing that session other user have reported da...
ROLLBACK after COMMIT
dba
2017-10-17T12:39:29.003
[ { "message": "I would like to change my stored procedure so it is no longer utilizing a cursor to function. How could I write this stored procedure better?I am using a cursor to compile dynamic SQL to query servers that I am creating from a list to track transaction log backup history.<pre><code>ALTER PROC [dbo...
How do I re-write this stored procedure to not use a cursor?
dba
2017-10-17T15:13:57.307
[ { "message": "CACHESTORE_SQLCP Sql Plans takes up > 38 GB after a few days.We are already running with \"optimize for ad hoc workloads\" option on. (Entity Framework and custom reporting creates a lot of ad hocs!)<blockquote> SQL Server 2016 SE 3.00.2164.0.v1 on AWS RDS with multi-AZ mirroring</blockquote>Whe...
Neither DBCC FREEPROCCACHE nor DBCC FREESYSTEMCACHE('SQL Plans') do anything to free CACHESTORE_SQLCP memory
dba
2017-10-18T23:52:40.983
[ { "message": "I have the following table, Input. Do you know how to group the tick data into minute interval as shown in the table, Desired Output using mySQL? I read the data directly from csv to mySQLCriteriaIt will take the last price within the minute bar and output as its minute bar. ie If I have the these...
group tick data to minute data using MySQL
dba
2017-10-20T00:31:11.257
[ { "message": "Here are two tables :table1<pre><code>id1(pk) objectid z0 1 1001 2 98</code></pre>table2<pre><code>id2(pk) n_sd prof alt_inf0 1 51 1 152 2 8</code></pre>objectid -> n_sd (1->n).The aim of the trigger is on insert on table2 to do the maths alt_in...
trigger on 2 tables one to many
dba
2017-10-20T08:02:02.563
[ { "message": "After a lot of searching, I finally was able to create a SQL Query to retrive Wordpress User Meta Data. Now the problem is, the performance is so bad it doesn't even show me a result after 30 min. Wordpress stores data in 3 columns: <code>user_id</code>, <code>meta_key</code>, <code>meta_value</co...
How to increase performance with joins to create VIEW from Wordpress wp_usermeta
dba
2017-10-20T17:55:27.960
[ { "message": "I am using XAMPP 5.6.23-0 on a Mac.I have experienced many problems with MySQL, where the server simply refuses to restart after something has happened (not sure which events make it crash). In the end, the only working solution was to re-install XAMPP. The problem is that the new installation doe...
Can I restore a MySQL table from a file (non-sql) backup?
dba
2017-10-22T09:05:16.483
[ { "message": "I'm trying to set up oracle-xe on my Linux machine. I just need an environment to play with Oracle SQL; this is not for production.When I try to start SQLPLUS I keep getting one of the following errors:<pre><code>ORA-12541: TNS:no listenerORA-28547: connection to server failed, probable Oracle Net...
Setting up Oracle XE on Linux
dba
2017-10-22T10:34:53.660
[ { "message": "Hi I would like to create a multi source replication topology where a few different master databases replicate to one big slave database. I want to know for each and every row on the slave from which master it came from.My first instinct would be to add a \"system_id\" column on each master table ...
Track row origin in MySQL multi source replication
dba
2017-10-22T12:30:41.497
[ { "message": "Is there a way to dynamically create folders in BLOB so each DB goes into its own folder? I know in Azure BLOB Storage they are not real folders, but I hope you get my point. In essence I am using the @URL instead of @directoryI am backing up (TLog) 30+ DB's every 5 minutes, and it is very cumbe...
Dynamic Folder Creation when Backing up to Azure BLOB Storage
dba
2017-10-23T14:53:28.340
[ { "message": "I've successfully installed postgres on my Ubuntu machine. I am running a script for a website I am working on, here is the relevant code:<pre><code>apt-get -y install postgresql libpq-devsu postgres &lt;&lt;EOF createuser app createdb ultimaterehabEOFPG_HBA=$(su postgres -c \"psql -t -P fo...
script breaks my ability to run psql
dba
2017-10-23T18:08:12.493
[ { "message": "I've been trying to resolve an issue which I think may be helped by changing the wait_timeout variable in MySQL (5.1.67) on my CentOS machine. So, I updated /etc/my.cnf with the value I want (180), and restarted MySQL, but now I'm surprised to find that I'm getting different values for wait_timeo...
MySQL - wait_timeout variable
dba
2017-10-23T18:11:24.740
[ { "message": "MySQL master has a table <code>Products</code> that has triggers on <code>update</code> and <code>delete</code>. Deleted/Updated records are stored in <code>ProductsUpdatedDeleted</code> tab. When a record is deleted, the operation is replicated to the slave server. The issue is that slave a...
MySQL Replication - Issues with Triggers
dba
2017-10-24T14:48:17.527
[ { "message": "Say I have a partitioned table, set up like so:<pre><code>CREATE PARTITION FUNCTION PF_Month (DATE) AS RANGE RIGHT FOR VALUES ( '2017-01-01', '2017-02-01', '2017-03-01', '2017-04-01', '2017-05-01', '2017-06-01',);GOCREATE PARTITION SCHEME PS_Month AS PARTITION PF_Month ALL TO ([Primary]);GOC...
Are partition numbers guaranteed to be in order of value?
dba
2017-10-24T19:58:28.583
[ { "message": "Mysql Database structure:I have two tables:Users Table with autoincrementing id contains about 20K rows and growing: <pre><code>id userName1 John2 Doe3 Alice</code></pre>Contents Table with autoincrementing id contains about 10K rows and growing:<pre><code>id Content1 Content12 Content23 Content3...
how to optimize mysql query/ structure/ approach for large datasets?
dba
2017-10-25T16:55:41.123
[ { "message": "This is a bit of a broad question but I am trying to understand a storage performance behavior with two of our servers.I was following <a href=\"https://www.brentozar.com/archive/2015/09/getting-started-with-diskspd/\" rel=\"nofollow noreferrer\">https://www.brentozar.com/archive/2015/09/getting-s...
SQL Server Disk throughput slower than diskspd
dba
2017-10-26T05:39:01.250
[ { "message": "I'm trying to set up some scheduled jobs which will collect some server stats, using system DMV's in SQL Server Azure. If a none SA users uses 'sys.dm_os_schedulers', they get an error (below), query works fine for server admin. VIEW SERVER STATE permission was denied on object 'server', database ...
Grant View Server State - is it possible for a none SA user to have in Azure SQL?
dba
2017-10-26T08:47:06.723
[ { "message": "I lose communication between my clusters almost 1 am to 1.30 am and it shows errors like 35206 on primary, 976 on clusters, sometimes the cluster is removed due to lost heartbeat leading to 1135 error , 1069 error. I have a strong feeling that my connection breaks everyday at that time but im clue...
Connectivity timeout between cluster nodes
dba
2017-10-26T14:08:12.457
[ { "message": "while Installing oracle 11gr2 on oracle Linux 7. The prerequisite condition to test whether the OS kernel parameter \"semmni\" is failed with below error.Please find the screenshot of it.<a href=\"https://i.stack.imgur.com/iDpE4.jpg\" rel=\"nofollow noreferrer\">Below is the kernel parameters whic...
Oracle 11gR2 Installation on Oracle linux 7 - Prerequisite condition failed for OS kernel parameter "semmni"
dba
2017-10-27T03:42:00.377
[ { "message": "What is the difference between Session Timeout and Heartbeat in always on...My Network is laggy and i get frequent connection timeout error on error logs and also at the I see missed heartbeat errors on the failover cluster errors ....Which settings should I change. Crossing which thresholds force...
Difference between Session Timeout and Heartbeat in always on
dba
2017-10-27T15:23:19.153
[ { "message": "I want to cleanup one of my tables which has 4 million. So I prepare this query to clean it. But it's throwing an error, can anyone please help me to fix this?<pre><code>DELIMITER $$DROP PROCEDURE IF EXISTS archive_table $$create procedure archive_table () set @min=(select min(dob) from test ...
MySQL - Delete table in chunks
dba
2017-10-27T16:55:30.323
[ { "message": "I want to cleanup one of my tables which has 4 million. So I prepare this query to clean it. But it's throwing an error, can anyone please help me to fix this?<pre><code>DELIMITER $$DROP PROCEDURE IF EXISTS archive_table $$create procedure archive_table () set @min=(select min(dob) from test ...
MySQL - Delete table in chunks
dba
2017-10-27T16:55:30.323
[ { "message": "The <a href=\"https://en.wikipedia.org/wiki/Java_Database_Connectivity\" rel=\"nofollow noreferrer\">JDBC <a href=\"http://jcp.org/aboutJava/communityprocess/mrel/jsr221/index3.html\" rel=\"nofollow noreferrer\">4.3 update arrived with <a href=\"https://en.wikipedia.org/wiki/Java_version_history#J...
What is the new JDBC 4.3 Connection Request feature with `beginRequest` & `endRequest` methods?
dba
2017-10-28T00:25:23.523
[ { "message": "I understand that pg_restore needs to connect to a database before it can start the restore process, is there anyway pg_restore can use the \"postgres\" database to create another database?I have the following command<pre><code>pg_restore -h \"192.168.1.212\" -p 5432 -U mysuperusername -C -d bp bp...
pg_restore to create database before loading it?
dba
2017-10-28T01:11:04.613
[ { "message": "I have to delete 16+ millions records from a 221+ million row table and it is going extremely slowly.I appreciate if you share suggestions to make code below faster:<pre><code>SET TRANSACTION ISOLATION LEVEL READ COMMITTED;DECLARE @BATCHSIZE INT, @ITERATION INT, @TOTALROWS INT, ...
Delete millions of rows from a SQL table
dba
2017-10-28T20:46:38.860
[ { "message": "I have to delete 16+ millions records from a 221+ million row table and it is going extremely slowly.I appreciate if you share suggestions to make code below faster:<pre><code>SET TRANSACTION ISOLATION LEVEL READ COMMITTED;DECLARE @BATCHSIZE INT, @ITERATION INT, @TOTALROWS INT, ...
Delete millions of rows from a SQL table
dba
2017-10-28T20:46:38.860
[ { "message": "I just upgraded our MySQL server from 5.5.53 by doing the following:<pre><code>sudo apt-get purge mysql-server-5.5 mysql-client-5.5sudo apt-get install mysql-server-5.6</code></pre>Which got me to version 5.6.33However, I'm looking to get to at least 5.6.4 where it appears the DATETIME datatype ta...
MySQL upgrade to 5.6.4 from 5.6.33 on Ubuntu
dba
2017-10-29T13:17:44.280
[ { "message": "I have a sql azure database that is used only for analytics.It is constantly being updated with data pushed from the OLTP system. The OLTP inserts/updates/deletes are pushed via webhooks to a service that propagates the changes into the analytics db in real time.As a result, we have a db that must...
Columnstore index on multi-tenant database
dba
2017-10-31T04:41:13.660
[ { "message": "I want to get the result for a particular ID if only all the \"Prospect\" have after it \"Qualify\", if not all the calculation will be droppedBelow is example sample and output. How it can be done using sql query?<pre><code>+----+----------+-----------+-------+| id | stage | nextstage | value1...
How to select records that meets specific criteria
dba
2017-10-31T06:01:41.460
[ { "message": "Users can be either student or teachers, and are able to do different things depending on which role they are. Can I just use <code>role</code> with a 0 or 1? I usually see lookup tables which map a user to a role to permissions and whatnot, but would that be overkill for this scenario?<pre><code>...
Storing whether a user is a student or teacher? Is a lookup table necessary?
dba
2017-10-31T08:22:16.353
[ { "message": "I have a database of 20 GB which insists in having its transaction log over 7GB.when I used <a href=\"https://dba.stackexchange.com/questions/84333/space-usage-on-sys-allocation-units-and-sp-spaceused\">this script to find out the size of the biggest objects in that database, I see they are relati...
how to identify the transactions that are causing the transaction log to grow?
dba
2017-10-31T15:58:34.193
[ { "message": "I am routinely taking a BAK file and restoring it. As a result of this action, an MDF file is generated from it by MSSQL.My problem is that after the detaching the database I need to be able to move the MDF file programmatically and the user that is going to do this needs to not be in the Administ...
Change Permissions of MSSQL Server generated files
dba
2017-10-31T17:49:49.693
[ { "message": "I ran a multi-threaded client spawning 25 threads to make concurrent API calls and insert data to AWS Aurora server.After some time, I started to see timeout error: <code>lock wait timeout exceeded try restarting transaction</code>.We run the same test for a server running MySQL 5.6.10, and no loc...
How to avoid lock wait timeout exceed and improve MySQL InnoDB write speed
dba
2017-10-31T22:07:58.427
[ { "message": "I'm trying to implement Change Data Capture in MySQL. I have seen that using Maxwell I can implement CDC but I'm confused where to start. Please help me with the detailed steps to implement it. And also tell me the prerequisites.", "role": "user" }, { "message": "Firstly I want to intr...
Change Data Capture in Mysql
dba
2017-11-01T06:01:50.040
[ { "message": "The question title might be a little misleading, but I was wondering what happens internally in a database implementation when the file used for storage are placed on a distributed filesystem (like Gluster or Ceph).I would imagine that the database implementation keeps some data in memory and will...
How does a database conciliate data to files on distributed filesystems?
dba
2017-11-01T12:01:46.890
[ { "message": "Regards to this <a href=\"https://stackoverflow.com/questions/47071904/system-data-sqlclient-sqlexception-execution-timeout-expired\">question that I had asked a day ago I want to know if there is any way that I could take the database backup in the number of smaller parts.Or If there is any way t...
Is there a way that we could backup the database in number of smaller parts or change the backup path?
dba
2017-11-03T11:04:47.010
[ { "message": "BackgroundI'm designing a table which will serve as a repository of payment information to be used for research purposes. This table will have around 4.5 million records initially and will grow at a rate of around 400k annually. The PaymentReference column would be the only unique column in the ta...
Ms Sql Server Table Design question
dba
2017-11-03T11:10:27.283
[ { "message": "I am trying to get a psql function that would truncate a given table name if it exists. I've been trying multiple functions, but none of them worked so far. Here is the code :<pre><code>CREATE OR REPLACE FUNCTION truncateIfExists(tableName TEXT)returns voidas $$BEGINEXECUTE format('IF EXISTS ( ...
Postgres : Truncate if exists in psql function with parameter
dba
2017-11-04T18:57:26.353
[ { "message": "I'm designing a database that will hold ticketing information. The 3 tables I use to track ticketing are <br> <code>tbl_ticket_type</code> to the types of events an event can have <code>tbl_ticket_count</code> to keep track of how many tickets of a particular type should be sold for an event <cod...
Calculate quantity of tickets based on how many reserved using sub queries
dba
2017-11-04T19:42:52.303
[ { "message": "I am trying to copy a database from a remote server. I don't have access to its backups or file system. My destination database on my dev machine needs to get all the data plus the same tables structures including primary keys with identity settings and the rest of the constraints.The Import/Expor...
How to set 'Enable identity insert' for all the tables at once during importing data in SQL Server?
dba
2017-11-04T20:18:53.323
[ { "message": "I am curious as to what solutions are out there for partitioning tables that log events, that allow both efficient querying and the advantages of pruning when truncating data.Suppose I have a simple table that records events from different locations:<pre><code>tblEvents ( event_id, location_id, ...
MySQL Partitioning on event tables with start and end datetime columns
dba
2017-11-06T02:24:36.317
[ { "message": "I've got two subqueries that I'm unioning together. Both subqueries return in &lt; 200 ms but when I union them I get a query that runs in about 6 seconds (union all). The first query returns about 1000000 rows while the second only returns 15 or so. Does anybody have any advice on what I could...
MySQL UNION ALL Performance
dba
2017-11-07T17:37:54.587