« first day (2116 days earlier)      last day (2752 days later) » 

5:21 AM
@ypercubeᵀᴹ Your comment "is the (id) the PK in every one of the 48 tables or not? How many rows does the query return for the single id (WHERE a.id=2)" was the most insightful and important IMO. It's a shame it was not responded to. Nine edits and 16 comments later, there is one very poor answer. sigh
I should do something about that, probably should have done earlier, but hey.
@dezso Maybe. I have no problem spending time on an answer to a "poor" question that is at least minimally clear, but there's nothing worse than writing an answer only to get a comment like "ah, I see I should have mentioned I am using robot penguins exclusively to execute my queries. Does that make a difference?".
 
 
2 hours later…
7:04 AM
Hmm, I hadn't known you could do this:
CREATE TABLE Test (Condition1 bit, Condition2 bit);
INSERT INTO Test (Condition1, Condition2) VALUES (0,0),(1,1),(0,1),(1,0);
SELECT Condition1 | Condition2 FROM Test;
SELECT Condition1 & Condition2 FROM Test;
 
And this: SELECT ~Condition1 FROM Test;
 
@PaulWhite He made an edit at some point, so the answer is "yes".
> Edit3: Every table has pk(id). Basic design idea looks to be that there is main object in table "a" and then it may have one or several subtypes(tables from b to zz) of data. query returns 1 row and 2000+ columns.
 
2000+ columns!
Because "why not"
But then maybe that was the best way for them, who knows
 
300ms, 50 tables, that's about 6ms for each clustered index seek.
and the answer at -5, insists that it's right
I think dumping result in temp table has more advantage then NOLOCKS as dataset will be limited. NOLOCKS also helps because table is doing a self join (50 times apparently) so it will make reads quicker. Something I have personally experienced in similar scenario. — mouliin 15 hours ago
 
7:19 AM
@ypercubeᵀᴹ To be fair, the second query in their answer (the one actually trying to produce the required output) does consist of a series of self-joins.
 
@AndriyM Oh, I hadn't noticed. thnx
Makes even less sense, that 2nd query
Ah, he may have answered before the edit in the original question. There were multiple joins to b, which I edited.
 
7:43 AM
How likely is it that this is the OP? dba.stackexchange.com/review/suggested-edits/79457
 
8:05 AM
@ypercubeᵀᴹ have any links that explain the outer apply trick?
or could you explain it without having to type half a book in chat :)
 
@TomV It was a suggestion to try (and with bad syntax). Not sure but while LEFT JOIN / OUTER APPLY are equivalent in this case, it may yield different plans
There is at least some one else at this room that knows much more about the optimizer and how it works.
My wild guess in that q, is that it finds a plan with 50 cheap clustered index seeks. I'm not sure why it doesn't find that some (or many) of them can be totally omitted.
Perhaps the OP hasn't provided enough info. I don't even see a CREATE TABLE
That type = 'something' that they use may be a varchar(max) for all we know.
@TomV My suggestion in comments was (corrected):
OUTER APPLY (SELECT * FROM b WHERE a.id = b.id AND type = 'typeb') b
The op did not make that correction so the code in the question is useless
 
@ypercubeᵀᴹ interesting
 
Did I answer your question?
 
Well I was confused by wat I saw in the question and how it could work
and how the trick would work you're unsure of, so I guess it's something to try out if I ever have a query that ugly created by our BI folks :)
 
8:22 AM
@TomV If there is indeed something to be gained in the situation, from doing 5 instead of 50 clustered index seeks, I'd also try to get the a row separately in a temp table or just the id and type in variables and have a second query for the rest 50 tables.
Or even better, ask PaulWhite what to do ;)
 
Thanks, I have no use case at the moment, but I wondered how the trick would work the way the OP edited it in his question
 
Awesome day rock climbing yesterday. icloud.com/sharedalbum/#B0S5nhQSTdp3sD if you want to see how pretty it is where I live
 
@TomV And I have no explanation for that 30% efficiency gain they claim.
Or why that plan has a Nested Loop.
The more I think about that q, the more I come to appreciate why such questions should be closed fast. so they can improved faster and not drag like this, with half info for days.
2
 
8:50 AM
@Philᵀᴹ which one is you?
the one behind the camera?
and did you solo an E9?
 
0
Q: How should relationship diagram look like with these statements

lewis4uI have 3 tables USERS ORDERS OFFERS 1 User has many Orders 1 Order belongs to User 1 Order has many Offers 1 Offer belongs to 1 Order If someone could help me to draw this diagram....i need help. I made it this far and i'm not sure if this is OK.

i just think something is missing here
 
@dezso Not good enough for E's yet :P
 
@Philᵀᴹ why, E1 is supposed to be something like 'you climb it blindfolded, with your back towards to rock face' (or maybe not)
otherwise Peak Disrtict is a destination on my shortlist
and with friends just moved to Manchester, it looks even closer
 
@dezso You should visit Meteora, Greece some time.
 
@ypercubeᵀᴹ too warm there :D
but yes, that's a fun place, too, with those chunks of stone sticking out from the walls
 
9:05 AM
@dezso I didn't know you were into rock climbing. See: xtremeway.com/rock-climbing/meteora-rock-climbing
@Phil, too! ^^^
 
@dezso I'm prolly on E2-E3 at the moment
Only just started it seriously
@dezso Happy to take you climbing there one day
@dezso I'm the one in the khaki coloured trousers. Aren't many pics of me
 
9:52 AM
@ypercubeᵀᴹ I more were than am
@Philᵀᴹ you did only toprope?
 
@dezso Yeah, going on a lead climbing course soon
@dezso You climb then?
 
@Philᵀᴹ not so often in the last years
I am usually good enough to lead out a UIAA grade 5 for 18 meters and then spent :D
 
@ypercubeᵀᴹ Thanks.
 
@Philᵀᴹ trad?
 
@dezso yeah. Going to get more practice indoor top-rope climbing over the winter, then do an indoor lead-climbing course around Christmas time, then a proper outdoor lead course up Stanage Edge in the spring
 
10:08 AM
@Philᵀᴹ sounds very reasonable (especially the latter)
 
10:29 AM
@AndriyM I've made some alternative suggestion in comments. I don't have SQLite ot test and their docs are not very comprehensive.
 
@ypercubeᵀᴹ SQLite is on sqlfiddle
 
@Philᵀᴹ Yeah. When it works
 
11:18 AM
This is only different in missing preventing the users to reconnect (with a sufficiently eager application this can happen real fast, I've seen this a few times already). — dezso 10 secs ago
 
11:41 AM
@dezso they mean ""this works if you don't have to worry ..."*
 
@ypercubeᵀᴹ so
still, it makes no sense to add this answer
 
I have no idea how that could happen in a production server (or stage)
whatever that is not in a dev box
@dezso so: -1 ;)
 
12:05 PM
@ypercubeᵀᴹ I did see that. Didn't cover the second question though? (number of rows for the where clause).
Anyway, I'm pretty sure he's asking about conditional joins, which I can say some things about. Perhaps when I get a few hours of answer time tomorrow.
 
12:17 PM
@PaulWhite "returns 1 row and 2000 columns"?
 
@ypercubeᵀᴹ Ah! :) Thank you ha ha
 
It's easy to miss when there are numerous edits and comments
 
@ypercubeᵀᴹ No kidding. Thankfully a system flag just popped up for excessive comments so I dispatched them.
 
@PaulWhite we know you weren't kidding
there was no explanation
 
And you know it would have gone on forever :)
 
12:32 PM
I do
 
@TomV Reading back, I'd just like to confirm what @ypercubeᵀᴹ said to you. Especially that without the details it's hard to know exactly what the question asker might be seeing. There are many possibilities, many of them interesting, but an answer that covered all of them would be quite time consuming to write.
@ypercubeᵀᴹ At the risk of pinging you for every comment you have written in the last 8 hours, yes, this. I am still not quite sure why I didn't close it as unclear early on. I'm not usually shy.
45
A: Why are questions closed immediately?

Cody Gray If 5 users votes for closing, that question will be closed immediately, at the same time if other users want to give answer to that question, they can’t because question is closed. In that scenario it does not make a sense to close that question immediately. Question should be close ...

Those 20-odd comments, ten question edits, and one (very poor) answer will serve as a reminder to me for some time to come why "close early, close often" is a good idea.
 
@PaulWhite Hey, Paul. How are you?
 
12:47 PM
@PaulVargas Quite well thank you. Getting many of my pings recently?
 
@PaulWhite Thanks I expected that it would be too long, that's why I initially asked if there was a link, if there isn't so be it.
 
@PaulWhite Nope, nothing. :D
 
@TomV If you're interested in why an outer apply with an outer reference predicate can sometimes be better than a left join of similar construction, it's often because the apply predicate translates to a Filter with a start-up expression, whereas the join may evaluate the predicate at the join, after the inner side has run.
I do appreciate I may not have painted an entirely crystal clear picture with that explanation.
Words are hard.
@Paul Well that's good news :)
 
Makes sense
Thanks
NAA, at least not to the correct question
-2
A: Fast query in mysql with table of 1B+ rows

Abhishek singhRight click the database and select Tasks then Import Data Click Next button. For Data Source select Flat File Source. select the CSV file. Next > button. For Destination, select the correct database Enter the Server name; check Use SQL Server Authentication, enter the User name, Passw...

 
0
A: convert csv to insert sql statements

AbhishekRight click the database and select Tasks then Import Data Click Next button. For Data Source select Flat File Source. select the CSV file. Next > button. For Destination, select the correct database Enter the Server name; check Use SQL Server Authentication, enter the User name, Password, and Da...

 
1:01 PM
Still doesn't make any sense :)
 
@PaulWhite Great! But we can't let our guard down yet.
 
@PaulWhite ah, I first thought you meant the meta answer
 
@dezso Yeah my communication skills suck more than usual today.
 
@PaulWhite Aussies have never been particularly articulate
 
humph
 
1:05 PM
@Lamak they are on par with Argentines
 
@TomV Is that Dynamics?
 
1B = one billion = 1,000,000,000?
18
Q: what is the correct abbreviation for millions, billions and trillions in a financial context?

jcollumI've found answers on the web but also got conflicting answers from financial professionals (coworkers). In metric, you'd use M (mega) for million, G (giga) for billion and T (tera) for trillion. The only financial specific similar abbreviation I can find is MM for million (financial notation, ...

 
@dezso exactly
 
@JamesLupolt It's explained a few messages further
But yes
Basically any non-int numeric is stored like that
You escaped just in time :)
 
Why would you want non-integer line numbers?
Do invoicing systems have decimal line numbers?
 
1:12 PM
-2
Q: Fast query in mysql with table of 1B+ rows

cehopejiConsider a MYSQL table with the following columns: source_id integer timestep integer position integer value float This table contains slightly more than 1,000,000,000 rows. The data is read-only and serves as source for certain analyses. What can be done to speed up the queries? I've crea...

 
I guess that makes sense if there is a hierarchy on the invoice
 
duplicate
 
@JamesLupolt 64-bit BCD ones apparently :)
 
I just don't get some SO users, specially gordon. Everyone answering here knew that they weren't addressing the problem and posted an answer anyway
why?
0
Q: UPDATE With Top is not working

bmsqldevHi I am trying to Update Column in a table with Different static date values. I try to do an update statement like below UPDATE f SET f.CLOSEDATE = '2016-10-23' FROM office f inner join ( select OFFICEID from paroffice where active = 1 and RowStatus ='A' AND DistrictID = 50000 )ofc on ( f.O...

 
@JamesLupolt They key is that you can insert lines between existing lines and the linenumber is calculated by summing and dividing
2
so if you insert a line between line 1 and line 2 it's numbered 1.5000000000
give or take a few digits :)
 
1:15 PM
Ah
 
@ypercubeᵀᴹ sigh
 
@PaulVargas well, the problem is usually more like how much is a billion (and not only in English speaking countries). Until this is not clarified, arguing about abbreviations is just for fun.
 
@TomV I had a silly answer at SO like that, a few years ago. Perhaps they read it ;)
 
> Your edit suggestion brings in all the worst practices.
my reject message on a suggested edit (adding Hi guys, changing MySQL to mysql and so on)
 
@dezso What is his problem?! I'd already edited it
"Md Haidar Ali Khan had 455 edit suggestions approved, and 170 edit suggestions rejected
"
 
1:27 PM
@Lamak why not?
 
well, ehm, you know..... because
 
Same as the Canadian/American thing :P
 
So awesome.
 
@ConcernedOfTunbridgeWells I'm just a guy from Chile, I don't know so many things ;-)
 
1:33 PM
some colleagues were watching me suspiciously - I left the volume at around 150%, so they could also enjoy the guys going crazy in the middle of this
 
 
1 hour later…
4:05 PM
@dezso always happy to learn something new :) 👍🏻
 
Hello all :) anyone know any magic settings in SSMS that speed up getting data from a linked server?
 
don't use linked servers :)
 
an INSERT INTO dbo.TABLE SELECT * FROM LINKEDSERVER..ORAUSER.TABLE is maxing out at 0.1MBps
@bluefeet thought that might be the answer
so I could generate a csv and then import it with BULK INSERT?
 
@JackDouglas did you try the same but using OPENQUERY instead?
 
@Lamak I did, and it was the same speed
that's basically all I tried though
 
4:14 PM
20
A: Which one is more efficient: select from linked server or insert into linked server?

Kin Suppose I have to export data from one server to another. Best is to use IF you want all data use Backup / Restore; BCP OUT & BCP IN or SSIS IF you want subset of data (some tables only) use SSIS or BCP OUT & BCP IN TO move data, depending on the amount/size of data and n/w bandwidth, L...

 
thanks, that's useful
 
4:31 PM
@JackDouglas sorry I can't actually help
 
Another unclear question. Just vtc: dba.stackexchange.com/questions/152880/…
 
I actually need to for like, if not possilble leave it. :( — apm 2 hours ago
what in the world does that means?
 
4:48 PM
@JackDouglas Something like that would be better, yes. There are all sorts of things that can make linked server queries slow, including poor-quality drivers. If a plain SELECT through the linked server is not slow, the underlying problem is likely the implied distributed transaction created by the INSERT. It may also use a row-by-row cursor model for the row fetch in that case, depending on details.
If you can find a suitable disconnected approach (export then import as separate steps) that will almost always be faster, usually very significantly. Much time has been wasted by many people over the years trying to optimize linked server queries.
 
@PaulWhite If I just run SELECT * FROM LINKEDSERVER..ORAUSER.TABLE from SSMS the throughput is the same, so I guess there is some kind of rbar going on. With the Oracle client there is a parameter call arraysize — setting it high makes a huge difference to throughput.
I think we will try something that doesn't go through the linked server, thanks :)
 
@JackDouglas I'm no expert, but I seem to recall that some ways of connecting to Oracle from SQL Server provide much better throughput than others. I do not recall the details I am afraid, so I am glad you can try something that will avoid the whole issue :)
Perhaps @Philᵀᴹ would know.
3
A: SELECT query using an array of tuples

Andriy MThere are various ways to obtain multiple IDs with a single query in your situation. First, you can just take the series of single SELECTs: SELECT ID FROM FOO WHERE col1=1 AND col2=2 AND col3=3; SELECT ID FROM FOO WHERE col1=4 AND col2=5 AND col3=6; SELECT ID FROM FOO WHERE col1=7 AND col2=8 ...

@AndriyM Does this mean you are our resident SQLite expert now? ;)
2
 
5:21 PM
Th OP certainly thinks so, doesn't he :) "the EXCELLENT response from Andriy M"
 
Indeed.
 
I guess I'm a generalist. The system recently confirmed that anyway.
But CL. is a SQLite expert, I believe.
 
@AndriyM Weird eh. It's hard to get less generalist that me, and I have that badge :$
 
Yeah, something must be broken. :)
 
@AndriyM Well congrats anyway.
 
5:36 PM
@PaulWhite Thanks, congrats to you too.
 
@PaulWhite Never had the pain of directly moving data between sql server and oracle. I've only ETLed
 
@Philᵀᴹ Very sensible.
 
Hi @Philᵀᴹ
 
@JackDouglas Greetings, fellow Earthling
 
6:02 PM
@AndriyM @PaulWhite congrats to both of you
 
 
2 hours later…
7:38 PM
@AndriyM we could add sqlite to the room tags if you want to have more "discussions" on that subject :)
 
@TomV Whether I want that or not, I certainly appreciate the attention :)
 
8:36 PM
Just saw a presentation on powerapps, yet another attempt at drag & drop programming
How long have we seen these kinds of attempts fail? 20-30 years?
The MS rep was stoked though :)
> Build apps without writing code
> Publish and use on web and mobile
 
8:55 PM
room topic changed to The Heap™ - Consultancy ©®: General on- and off-site discussion for dba.stackexchange.com [mysql] [nosql] [oracle] [postgresql] [sqlite] [sql-server]
 
 
2 hours later…

« first day (2116 days earlier)      last day (2752 days later) »