0
votes
0answers
12 views

Postgres row level security policy

How do I list names of all the available policies in the database? Something like: SELECT oid,relname FROM pg_class WHERE relrowsecurity = 'true' But I need to know the policy name
0
votes
0answers
7 views

mysql error: Could not open or create the system

I am getting following error message in /var/log/mysql/error.log file. 2016-07-25 21:36:01 16376 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or ...
0
votes
1answer
14 views

Should I shrink the Log File

I am a developer but have to do DBA stuff now and then. We had a problem where the Transaction log files of our DBs where increasing to large size of 50GB while the data file (MDF) was only 10-15 GB. ...
0
votes
1answer
7 views

Why do cross-database statements break replication when using filters?

For example, say you you have table A and table B on the master and on the slave you've set up replicate-do-db = A. Now if I do something like this: USE B; DROP TABLE A.sometable; Why should this ...
0
votes
1answer
8 views

ilike search really uses its index?

I have a column called nickname and have created index for it. create index test_idx on test_table using btree (nickname); My query is, select * from test_table where nickname ilike '%pga%'; ...
0
votes
1answer
12 views

SQL Server Performance hit after cache rebuild

After I rebuild my indexes and update my statistics, SQL Server will have to rebuild the execution plan cache to get up to speed with the current setup. So, will the SQL server do this immediately ...
-1
votes
0answers
10 views

How to use count and groupby to create many columns

I have a simple table named A with 3 columns: product_id first_date second_date. If first_date==second_date then up_to_date. if first_date<second_date then nearly_over_date, else over_date After ...
0
votes
0answers
9 views

Compare Previous and Current Year Sales

I am seeking advice on how to modify my sales query that will compare 2 separate years (current and previous years) and do some calculations for the two years. Below you will find my current sales ...
0
votes
0answers
11 views

Help Interpreting a group by clause

I have the following Group By clause: Group By Grouping Sets (a, (b, Rollup (c, d)) ) My thought process is Grouping sets ( a ) Union All Grouping sets( (b, Rollup (c, d) ) ) Then expand the ...
1
vote
0answers
13 views

SQL 2016 StackDump: SQL Server Assertion: File: <pageref.cpp>, line=951 Failed Assertion

I've received a few nasty errors from SQL on my development data warehouse. I'm running 13.0.1601.5 RTM Developer Edition (64-bit). Server is Win2012 with 64Gb of RAM running on VMWare. SQL Server ...
0
votes
0answers
6 views

SSRS 2012 Report with Oracle database as datasource never finishes

I am investigating a SSRS 2012 Report which used to return data from an Oracle database. However, recently it stopped returning data. The report will sit there and run forever until something times ...
0
votes
1answer
9 views

MySQL. Relationships

Thanks in advance for your answer. I am trying to tune my db skills. I have 3 tables: Brand, Model and Item. All models belongs to a brand, but an item can have a brand but not a model. I have 2 ...
0
votes
0answers
12 views

psql multiline commands: How to edit previous lines?

When writing a query across several lines in psql, sometimes I realize I've made a mistake in one of the lines previously written. In the following example, select * form ( etc, etc... there is a ...
0
votes
0answers
5 views

MongoDB HA by reading from Last Secondary not working

Our topology is (1 MongoDB server at each location) Primary Datacenter (main server, priority 10 ) DR datacenter (active standby, priority 5) On-Prem datacenter ( When shiz hits the fan, priority .5)...
0
votes
0answers
9 views

Improve query speed for large, wide table

I have created a medical claims database using PostgreSQL 9.4.1 and pgAdmin III. There is one table with ~61 million rows and 103 columns. The table has the structure given below. It is static and ...
1
vote
1answer
16 views

Should I use TINYINT for ID (PK) field in MySQL?

Should I perform this type of optimisation if I know that a table can't have more records than 10?
1
vote
1answer
14 views

MySQL. Default length for a field

Is there a list of already set standards for some common fields like: firstName, lastName, email, phone? I see most people just set varchar(300) to all fields, does it affect performance in any way?
0
votes
2answers
19 views

SQL Server - Select last value given a date

To make it easier, I have data that looks like this as an example: What I am trying to return is the Amount of the Balance Update as of a specified Date for each Investor_ID. For example, if my ...
0
votes
1answer
20 views

stored procedure logic,data flow visualization tool [on hold]

I have a very poorly written stored procedure with cursors, if else etc. Is there any toll available to visualise the logic and data flow? Thanks
0
votes
0answers
7 views

SQL Sum column til value and then increment group and continue summation

I've run across an interesting problem that I'm not sure how to tackle. I've been charged with finding a solution to the following scenario, and I'm not really sure where to go with it. Here is the ...
2
votes
1answer
25 views

How to show when loan was paid off

First time posting but have been a reader for over 10 years. I have a need to show when a loan was paid off regardless of the rolling balance from refinancing/taking out additional loans. In the ...
0
votes
0answers
16 views

How to split a single query into two?

I'm trying to figure out how to split a single query into two separate queries. The following two queries is what I want: Query #1: Label Value TOTALSTUFF 100 Query #2: ...
0
votes
1answer
13 views

SQL Server: Msg 512, Level 16, State 1, Subquery returned more than 1 value

This has me baffled, as I have tested multiple variations of the correlated subquery to no avail. Since the MAX function is suppose to guarantee a single result, I'm almost convinced that the problem ...
1
vote
1answer
17 views

SQL Server 2014 (12.0.4439.1) to SP2 (12.5000) service start failure

In what seems to be eerily familiar to the oh-so-famous SSISDB SP1 fiasco, I've hit a snag while upgrading our DEV server to SQL 2014 SP2. The base version was SP1+CU5 (12.0.4439.1). We have SSISDB ...
0
votes
0answers
17 views

Database design for user info

I am working on a django app and would love so help on a design issue I cant seem to wrap my head around. Basic Info The landing page of my app will show a table of all registered users which will ...
0
votes
0answers
7 views

CPU trends in DB level report by script in sql server 2014

CPU trends in DB level report by script in sql server 2014. Any script for finding the DB level CPU usage report for couple of days. Example: We have 10 DB's in server and need to know about CPU ...
0
votes
0answers
12 views

(SQL Server) How to Generate Schedule Based on Datetime Range and Duration

What I am trying to do is generate a schedule based on an input date. There are start and endtimes for each visitation period listed in MyTable as StartTime and EndTime. Data in MyTable would be: ...
0
votes
1answer
19 views

Trigger on replicated DB

If I have database db1 with schema sch1. I want to create another schema sch2 which will be used by different application and the tables in sch2 will be populated from tables in sch1. So my approach ...
3
votes
1answer
36 views

Why is this filtered index not only not used but errors when I try to force it

I'm trying to tune a rather annoying query where a number of the tables have something that looks like: date = '9999-12-31 23:59:59.9999999' At least a few of the tables are in the 300 mil row ...
0
votes
0answers
14 views

PostgreSQL 8.1 Corruption Issue

I have an old Postgres server that some major corruption problems on one of the databases. We first noticed the issue when the drives started to fill up on a database that should have plenty of space. ...
0
votes
0answers
14 views

Lock Request timeout causing Orphaned spids

I have an issue where an application with a single connection to the database, got a lock request timeout. In my mind a lock request timeout can only happen if a query waits for a resource for over 5 ...
1
vote
2answers
9 views

Why CONCAT on two columns in postgresql used in INDEX causes ERROR: functions in index expression must be marked IMMUTABLE

I am facing following error: ERROR: functions in index expression must be marked IMMUTABLE when trying to create index like this: CREATE INDEX full_phone_number ON orders_clientphone (concat(...
0
votes
0answers
18 views

Oracle; Table column reducing fails with 'value too big' error although such data doesnot exist

I am importing data for a table from one server to another server (both tables are of same structure) with command like below insert into table1 select * from table1@dblink1; The table1 has a ...
0
votes
2answers
23 views

when were the sys-dm_os_wait_stats last cleared? sql-2005!

I intend to monitor the execution of my stored procedures in a specific database, using the following script, which I got from How can I monitor the call count per stored procedure per timespan? ...
2
votes
0answers
12 views

Converting a looped INSERT.. ON CONFLICT to a wCTE in postgres

I have an events table: Column | Type | Modifiers ---------------------+-----------------------------+--------------- ts | timestamp without ...
0
votes
0answers
10 views

how to force postgresql to filll work_mem?

i'm currently investigating a situation where my PostgreSQL 9.3 instance was killed by the Linux OOM Killer and went to recovery mode. The machine is EC2 Server with 16 GB of RAM and has rather few ...
0
votes
1answer
16 views

SSISDB Maintenance job cleaning data very slow on SQL Server 2014

On SQL Server 2014 Microsoft (12.0.2430) SQL Server Enterprise: Core-based Licensing (64-bit) after changing the retention period from 365 to 90 since last 2 days job clean up about 2 GB of data only. ...
0
votes
0answers
13 views

Star Schema from Relational Database

I'm a newbie to data warehousing and I've been reading articles and watching videos on the principles but I'm a bit confused as to how I would take the design below and convert it into a star schema. ...
0
votes
0answers
20 views

how to find out the next time a job is scheduled to run in sql - in real time and even if the job has never been run before

I have a very similar question here but the problem with that question/ answer is that it does not work for all situations. for example, for the jobs that I have just created and have not been run as ...
0
votes
0answers
10 views

Synchronize more than two databases mysqlyog

I use mysqlyog in order to synchronize two databases. My question is whether I can use it in order to synchronize more databases. (I have one development database and I would like when I make a change ...
1
vote
1answer
32 views

How to set column DEFAULT using value of a variable

In a script for setting up a database which uses random UUIDs for primary keys, I have: CREATE TABLE alpha (id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), value INT); CREATE TABLE beta (aref UUID ...
0
votes
0answers
16 views

How knowing information between linked servers (MySQL & MS SQL)?

I am new to StackExchange Database Administrators and have just a little bit of experience with Databases (mostly MySQL). I have been asked for my job to link a MySQL Database to a MS SQL Database, ...
0
votes
0answers
17 views

UNION Query rendering 2 columns

I am using Access 2013 SQL. I have the following query qry structure: SELECT TOP 10 [Sub Category] AS Category_1 FROM tbl WHERE [Category]='1' GROUP BY [Sub Category] ORDER BY SUM([Value]) DESC; I ...
0
votes
1answer
14 views

Issue with getting data from XML file by using SSIS

I'm getting the data from XML file on the internet like below: <?xml version="1.0" encoding="ISO-8859-1"?> -<exchangerates type="Exhange rates" xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
0
votes
1answer
16 views

index and small set of possible values

I have a string column that I want to be part of a multi-column index in a large table in MySQL. There can be only a few different values in this column. If I knew these values in advance, I could ...
0
votes
0answers
27 views

I need to merge two queries with condition

I have the following query: SELECT URYRR_FORWARDS_REC_H.CB_LINE as "CB_LINE", URYRR_FORWARDS_REC_H.CB_LINE_DESCRIPTION as "DESCRIPCION", URYRR_FORWARDS_REC_H.UYU_BALANCE_FW as "MONEDA LOCAL", ...
0
votes
3answers
51 views

Is GUID(uniqueidentifier) not suitable for a clustered index? [on hold]

When i use uniqueidentifier datatype for primary key column then it will automatically create clustered index... So, will it slow down my queries or not ? I am explaining some description of my ...
1
vote
0answers
30 views

How to select random groups of similar records?

I have following table: create table users ( id serial primary key, gender text not null, age integer not null ); insert into users (gender, age) select (case when i % 2 = 0 then 'male' else '...
2
votes
1answer
6 views

Cassandra nodetool repair scheduling and gc_grace_period

I am trying to devise a scheme with minimal repair frequency to not overload the system, and have a problem to understand how can I ensure that the data is not getting resurrected. I have a cassandra ...
0
votes
0answers
10 views

how to use where class to find difference between two tables [on hold]

I want to find the difference between dates from two tables i want the query to find the difference only for the same department of the two table. please help me with this query update project....

15 30 50 per page