I am dealing with performance issues with a Windows app that uses SQL Server Express (2012) on the back-end.
I have managed to get this running a lot better primarily by reviewing the indexing SQL Server side but there is one particular report that is still running quite slowly.
Looking into wh...
I'm not sure I understand what the problem is. If all the databases, including the shared one, are on the same server instance, why do you need to replicate the shared database's data in other databases instead of just accessing the source directly from the application when required? — Andriy M3 mins ago
@ypercubeᵀᴹ - the number after the query is the number of times that exact query is being executed, i.e. the query "SELECT * FROM "Patient" WHERE "_Recno" = 35051" is being executed 106 times, with that _Recno. There are actually 1,031 queries being executed to build this report (in this instance, it varies) - the 23 or so above are the DISTINCT queries. As to how it connects, it is using Windows authentication and I am pretty sure TCP/IP but I don't think I'd be able to change this anyway. Can you think of performance options related to that? — Ivan McA52 mins ago
@MikaelEriksson My wild guess (based on the above comment ^^^) is that the app/ORM sends a query for each column of each table it needs. Or something equally silly.
I am trying to insert data into Temporary table with the help of Select Statement
The query is:
insert into tempProductCategory1
select * from ProductCategory ;
Problem is that this query running fine but takes so much time.When I check the execution status with the help of show...
Group Policy can be hilarious when done wrong. Laws are going to be the same when Donald Trump gets into power. He'll be pushing them and people will be WTFing
Quiz (standard SQL): What is the output of this query?:
create table a (name varchar(10));
insert into a values
('one'),
('two'),
('three'),
('four');
select count(*) from a
where name in
('one',
'two'
'',
'four');
I think I remember something about MySQL treating consecutive string literals as parts of the same string. Effectively 'two' '' would mean CONCAT('two', '') and thus just 'two'.
Yeah, so we were mocking MySQL and didn't even know that it had implemented a piece of the standard that perhaps no other major product had. So it's got at least one part of the standard absolutely right, even though that bit is utterly useless, even potentially harmful, capable of causing mistakes that you could take hours and hours to find.
> Two string constants that are only separated by whitespace with at least one newline are concatenated and effectively treated as if the string had been written as one constant. For example:
And I don't know which version of the standard had this. The copy of 2011 I have does not mention "at least one newline".
Oh, and they are saying: This slightly bizarre behavior is specified by SQL; PostgreSQL is following the standard. (Where by bizarre behaviour they apparently mean the fact that SELECT 'foo' 'bar'; is not valid syntax – because there's no newline there, I understand.)
So according to that, treating SELECT 'a' 'b' 'c' AS s as valid SQL must be an extension to the standard then.
Anyway, even though it turns out that at least one newline is required between two consecutive literals for the syntax to work as per the standard, I would still hate it to be implemented in T-SQL. I think it much, much safer if that always produced a syntax error, as it currently does (in SQL Server, I mean). There's enough possibilities for subtle errors already as it is.
> The intent of allowing separators at all is evidently to allow very long literals to be split across lines. Which is fine, but I wish they'd used some explicit syntax to specify continuation. The existing definition is pretty error-prone, as you found out.
Not surprising. Pity that wasn't obvious to enough people at the time of suggesting the syntax as part of the standard (or when deciding to implement it in products that have implemented it).
One of my servers had a hick-up yesterday and decided to leave temporary table while (while running alter table add indexes).
ls -l *sql*
-rw-rw---- 1 mysql mysql 8570 Mar 13 12:05 #sql-ib32694.frm
-rw-rw---- 1 mysql mysql 98304 Mar 13 12:05 #sql-ib32694.ibd
mysql> drop table `#mysql50##sql-i...
I have this table structure and am attempting to return the two rows where loglevel is null. How should the query be written in order to return this?
Based off the sample DDL Below I want 2 rows for names returned:
Pink Pig and Green Glove
Declare @stuff Table
(name varchar(50), vendo...