« first day (1298 days earlier)      last day (3563 days later) » 

1:35 AM
boom
0
A: vertica copy unix epoch into TIMESTAMPTZ

KermitYou would need to explicitly define the column list, use a filler and then derive it to transform the data type on load: CREATE TABLE public.test ( datetime TIMESTAMPTZ NOT NULL ); COPY public.test (unix_timestamp FILLER VARCHAR(15), datetime AS TO_TIMESTAMP(unix_timestamp))...

 
 
5 hours later…
6:21 AM
The question has been updated but is less clear to me now than before.
Regarding your update, I don't really understand the actual problem you are facing. Is this about your table already having ranges that overlap and you wanting to detect and resolve them? — Andriy M 59 secs ago
Someone have any idea what it could be?
 
 
2 hours later…
8:19 AM
@AndriyM They probably have not understood how that answer works.
 
@ypercube That's what I now suspect too.
 
@PaulWhite Nice. But why did @swasheck delete his answer? Seems to be that it's a good suggestion.
 
8:37 AM
Tempted to answer that it's just not possible to get Mongo to be faster than Postgres. I'm sure I'll get a gazillion upvotes (for a rather troll answer.) — ypercube 1 min ago
 
8:51 AM
@ypercube Hmm, it appears the OP has created another account for some reason. They might be unable to reply to the comments.
 
9:03 AM
18 hours ago, by Paul White
Computed columns that reference functions that access data should be illegal. Shot at the border.
18 hours ago, by Paul White
@swasheck It's up to you. Part of me would hate to see your creativity destroyed. But another part of me would like to see data-access functions in computed columns destroyed. So I'm conflicted :)
 
18 hours ago, by swasheck
gone. besides, the actual answer is @PaulWhite 's which is why i was asking about the actual delete statement. in the end, we can simply blame it on entity framework
 
thnx.
 
9:35 AM
No one tested or spotted the error in this code:
2
A: How do I place leading zeros for numbers less than 10 without affecting those 10+?

PhrancisUPDATE MyTable SET MyColumn = '0' + Mycolumn WHERE MyColumn < '10' AND MyColumn NOT LIKE '0%';

 
Tempted to answer that it's just not possible to get Mongo to be faster than Postgres. I'm sure I'll get a gazillion upvotes (for a rather troll answer.) — ypercube 1 hour ago
nice job :D
 
What is this guy talking about? I feel I just don't understand something.
Unfortunately it needs to be almost live. Also aggreated results would not be efficient because those logs are not for one user. They are for different user. However I do generate archived reports for reports a user has requested. But they are only valid for 30 minutes. — yoshi 27 mins ago
 
10:03 AM
@ypercube does not make much sense
 
10:16 AM
I just got asked to suggest why Azure might not be a great platform for a data warehouse.
- No support for master data services
- No system data dictionary (is this for real - not 100% sure from my google-fu)
- No sharepoint integration, PowerView etc.
- No table partitioning
- No standard backup/restore
- Requires clustered indexes (not necessarily desirable for fact tables)
- Does not support the profiler
That's what a bit of google-fu turns up. Reality check - is that correct?
 
I'm pretty sure all of those were true in the past (I'm assuming you mean SQL Azure here, not running your own SQL instance on an Azure VM?)
I just don't know if they're still true today
 
10:47 AM
Now for my daft SQL server question - does anyone know how much transaction log a secondary node in an AG will hold?
 
11:11 AM
I like this phrase "bug compatibility". So, SQLite tries to be compatible with MySQL's bugs, nice! — ypercube 18 secs ago
4
 
11:23 AM
@ConcernedOfTunbridgeWells They did mean SQL Azure not just Azure, right?
@ypercube really good catch
@SimonRigharts just noticed you asked that already :)
 
 
2 hours later…
1:08 PM
hi
 
JNK
hi
 
@user3732505 are you Karthick?
 
JNK
@JackDouglas looks like he is based on linked accounts
 
1:26 PM
dun dun dun
 
0
A: Whether Logfile Shrinking is good or bad one for Performance in SQL?

Yasir ArsanukaevIn SQL Server, log file is used to support transactions, guarantee transaction isolation, and database consistency. If you remember the structure of the log file, you know that it may grow in the following cases: When there are huge DML (UPDATE, DELETE etc.) activity within database done by one...

VtC
 
@SimonRigharts not sure i understand the question
 
1:43 PM
That would make a great epitaph
@YasirArsanukaev Voted to move. But, how does the log file support transaction isolation?
 
@PaulWhite Thanks for moving (closing).
Yep, I may be wrong here. Let me think. I might have confused the isolation mechanics of SQL Server with those of Oracle which uses undo to support isolation.
 
@YasirArsanukaev If you're thinking of MVCC, SQL Server uses a different mechanism (the version store). In any case, I think the answer would be better without that statement.
 
Then I remembered that SQL Server combines undo records and online redo log files (as these are called in Oracle) into one file called log file.
 
I don't have much of a clue about Oracle I'm afraid.
 
Yeah, probably you are right. I just thinking and trying to remember if I remembered everything else correctly and whether it's better to delete than to edit the answer :-D
 
1:51 PM
@YasirArsanukaev Seems fine otherwise.
 
@PaulWhite I think I beginning to remember. It stores undo records (well, versions if we talk about SQL Server) in a separate database!
Right?
 
@YasirArsanukaev SQL Server stores row versions in the version store in tempdb.
 
That doesn't affect logging much though. Undo and redo are still generated as normal in the transaction log even when row versioning is in use. It has to do this to ensure recoverability of the database.
i.e. Row versions are in-memory only, not persisted.
 
And those are started to being produced and stored there (afair) when we're enabling RCSI.
 
1:54 PM
Or SI, yes.
Though things like AFTER triggers and MARS use row versions regardless of RCSI/SI, and there is a separate version store for online index operations.
 
@PaulWhite "Row versions are in-memory only, not persisted" When you said "in memory", you assumed they are temporary (though they go to log file), right?
So that transaction can be rolled back and they are forgotten right afterwards.
 
Row versions and redo/undo log records are quite separate concepts. Row versions have nothing to do with rollbacks in SQL Server. Also, row versions are not logged (they're temporary, after all).
 
@JackDouglas Yes
 
Well, I just talking only about log file and ongoing transaction not in RCSI mode (Not a native English speaker :)
I mean undo records of the transaction are not persistent in the sense they can be forgotten if the transaction is rolled back.
 
Depends what you mean by "forgotten". The log record containing the undo information is persistent, and not deleted even if the txn rolls back.
 
2:03 PM
@mods, I don't know how to flag this. OP asks a question at the DBA site. After an hour (I was just about to comment), they delete they question and ask it (identical) in the SO site. They get an answer there, and we have the discussion (see comments:)
1
Q: How to construct a set-based query for a subset?

MacinI have a DB of the following structure (picture shows simplified version) How should I construct a query to get only those recipees, that can be cooked, i.e. for each ingredient in a receipe requiredQuaintity > availableQuantity? I tried this: SELECT r.Name FROM Receipe r JOIN RecipeIn...

 
@PaulWhite Yeaah, I know -- until you commit a txn and backup (truncate) the log file, or commit the txn and SQL Server switches over to the beginning of the log file and overwrites over VLFs, afair.
 
And then, they proceed to ask again (or undelete probably) at DBA: dba.stackexchange.com/questions/72268/…
Now we have 2 questions, in 2 sites, with similar answers but by different users.
 
Messy.
 
I wonder if I can read all 640 issues that I don't have of Amazing Spider-Man Volume 2 in a month?
 
@PaulWhite "Row versions are in-memory only, not persisted" I think I figured what you meant: the versions not go into database backup and are being forgot with time (can't remember the whole mechanics at the moment), so only committed versions are those that persist (in log -- and thus in backups).
@PaulWhite Also, thanks for editing the answer!
 
2:16 PM
is there a way to force a specific type of code formatting on SO?
I want to mark a piece of code as VB.Net
 
@MaxVernon Yep, gimme a moment.
 
@YasirArsanukaev thanks!
 
115
Q: What is syntax highlighting and how does it work?

ben is uǝq backwardsI noticed that sometimes my code gets highlighted in different colors when rendered. What is syntax highlighting? How does it work? What if my code isn't highlighted correctly? How do I report a bug or request a new language? What languages are currently available on Stack Exchange? Return to...

 
<!-- language: lang-name -->
 
Or
#lang racket
(define fortytwo 42)
(define (det a b c)
  (- (* b b) (* 4 a c)))
(provide (fortytwo det))
2
 
2:26 PM
@YasirArsanukaev gorgeous!
42 42 42 42 42 42 42 42
thanks everyone!
 
2:40 PM
for the benefit of developers present, I figured out how to connect to a remote SQL Server in an untrusted domain using the Windows API.
0
A: How can I impersonate a user from a different, untrusted domain, the way Windows 7 does it?

Max VernonFor the benefit of future visitors, I'm posting some VB.Net code that allows a process to use NETONLY impersonation to authenticate against a remote server that resides in an untrusted domain: Option Explicit On Option Infer Off Imports System Imports System.Runtime.InteropServices ' DllImpor...

 
:-D
(Continuing the discussion about log) For some reason Oracle's online redo looks more elegant to me than SQL Servers redo log.
The latter tends to grow and occupy all your disk.
 
@ypercube source?
 
Oracle on the other hand just copies the current log file when it's full of redo (which can be as big as 54 mebibites) to archive log and switches over to another log (there can be two or more log files) always keeping redo log at the same size (fixed).
 
@Kermit It's in the answer I commented.
 
@ypercube yup. nevermind... thanks
 
2:51 PM
booyah, beeyotches. Ready for another day of crushing dreams?
 
@JohnP Do you like databases? :D
 
@YasirArsanukaev presumably it shrinks after a backup?
 
@PaulWhite I felt much the same way about learning SSAS and MDX. At the time (circa 2001) there was almost nothing written about it.
 
@YasirArsanukaev - Yeah, I do. Don't know as much as I want to about them, but I'm learning.
 
@JackDouglas Never shrinks. You just add the redo log file during the database creation or afterwards specifying its size and it always stays at the same size. You may add, drop online redo log files specifying different sizes though. But they never grow or shrink neither manually nor automatically.
 
2:54 PM
@YasirArsanukaev I mean on SQL Server?
 
@JohnP Just never seen you here. And (prolly) no answers on DBA.se :-]
 
if it shrinks after a backup it's analogous to the online and archivelog files all concatenated
@JohnP I've learned a lot just hanging around in this room :)
 
@JackDouglas Well, sort of. But what grows is the disk(s) that the full online log file archived (copied online log is called archive log in Oracle) to, not the disk where online log is located.
@JackDouglas @JackDouglas Do you learn Oracle, MySQL, SQLite also? I just noticed (based on your profile) you're predominantly an SQL Server guy (-:
 
@YasirArsanukaev yup that's true, but it makes some sense to keep them together anyway as they are both needed for recovery
 
@YasirArsanukaev - two answers, no questions yet. I'm a developer with a (long ago) background in basic DBA stuff, now I'm revisiting and learning.
 
3:00 PM
@JohnP I see. Welcome! ;-)
 
@YasirArsanukaev Ha ha, no, I'm an Oracle/postgres guy with a bit of SQL Server and MySQL
 
@JackDouglas Oops, sorry, prolly confused you with @PaulWhite :-D
6
Then what I'm talking about online log is not interesting to you (unless you're into discussions!)
 
@YasirArsanukaev Wow, what a compliment, I will pin that forever :)
3
and I love discussing the differences between Oracle and SQL Server, they are fascinating, not least the old "index reorg/defrag" debate.
but pg is where my heart is
 
@JackDouglas what came of your "project?"
 
@JackDouglas Yeah. Correct. But something makes me think that planning your LOG_ARCHIVE_DEST_n (or Fast Recovery Area) destination sizes or making more room in them afterwards (when the workload grows) is easier than shrinking log file and adapting your backup strategy in SQL Server. Don't you have the same feeling?
@JackDouglas never heard of that debate yet :-)
 
3:14 PM
@swasheck I abandoned it after getting a nice (unrelated) email from this nice chap
 
Hm. I rejected this edit but I should have marked the suggestion as helpful, nonetheless!: dba.stackexchange.com/review/suggested-edits/28764
The question starts with "I am using MySql server", while it's obviously about SQL-Server.
 
@JackDouglas hmmmm. trying hard not to read too much into that
 
7
A: When should I rebuild indexes?

Nick Chammas When should I rebuild the indexes in my relational database (e.g. SQL Server)? You should rebuild indexes when they become highly fragmented by special events. For example, you perform a large, bulk load of data into an indexed table. Is there a case for rebuilding indexes on a regular b...

 
@ypercube I either often confuse them when discussing with someone :-/
 
@YasirArsanukaev But you are an Oracle guy. They use the product.
 
3:19 PM
@JackDouglas what's the oracle perspective again?
 
@swasheck don't rebuild
 
right. but why?
 
@YasirArsanukaev orafaq.com/node/2903
@swasheck Nick sums it up well in the answer I linked to, and there are exceptions
 
@swasheck oh
 
but basically, rebuilding is robbing Peter to pay Paul
usually better to have a steady state than regular defrag+extra subsequent logging
 
3:22 PM
That's fine. Peter has far too much cash.
@ypercube I don't think it's possible to reject an edit and mark it as helpful.
 
@JackDouglas Afair this chap (rleishman) had great article on index structure and comprehension.
 
@PaulWhite I should have improved it then. But you have done that now, so all is fine.
 
@swasheck don't read too much into it :) btw I'm stepping down as mod over on BH.SE, I'm just working on my meta post.
 
@ypercube Oh I see what you mean. Yes improving and marking as helpful would have been better (I rejected, then edited). Wasn't thinking.
 
4:15 PM
boom
1
A: Vertica partition by week on datetime:TIMESTAMPTZ

KermitIf you are confident that there will never be a time where you have data from the same week over more than one year, you just need to add the AT TIME ZONE part to the TIMESTAMPTZ type: CREATE TABLE public.test ( date TIMESTAMPTZ NOT NULL ) PARTITION BY WEEK(date AT TIME ZONE 'UTC'); Oth...

 
Undo is probably the best feature ever.
@Kermit TimeStamptZ? Who knew Vertica was so hood?
 
west side represent
 
@AndriyM What in the world is she talking about???
> Yes, and what I've been seen saying all along is that your decision to take matters into your own hands and vote for just one of two perfectly good answers is taking the aggregate role of the community and stealing it for yourself!
stole the role of the community??
 
@Lamak link!
 
not sure if I want to post it, same discussion from yesterday....sigh
@AndriyM: Yes, and what I've been seen saying all along is that your decision to take matters into your own hands and vote for just one of two perfectly good answers is taking the aggregate role of the community and stealing it for yourself! The aggregation can't work effectively if everybody is gaming it to promote a single answer - what if everybody is trying to promote a different answer? There's no point in voting at all then because it's all entirely arbitrary. — Lightness Races in Orbit 23 mins ago
 
4:19 PM
good lord
0
Q: Joining across 3000+ tables

JohnHCOk, strange one here I have a database for customer data. My customers are businesses with their own customers. I have 3000 tables (one for each business) with several thousand email addresses in each. Each table is identical, save the name. I need to find a way to find where emails cross over...

 
she seems to think that by choosing to vote one answer somehow prevents the whole community to vote for other answer
 
Find the person who designed this monstrosity and punch them in the head. Second tell management this structure has to be changed as it is completely asinine. Third if management refuses then find a new job as this one cannot possibly be paying you enough to put up with this level of incompetence. — Zane 47 secs ago
 
@ypercube thanks for the vote confidene
 
@bluefeet MySQL too. I have a solution but it's SSIS based.
 
@swasheck We had a discussion at work with a colleague about English names (and other words) with a Greek etymology, like Philip, Alexander, hippopotamus, etc.
He finds it weird that we have so many compound words.
 
4:31 PM
"we" = Greek?
 
yes
 
sooooo does his head explode when he examines german?
 
His grandma is German actually.
 
so the irony is lost on him
;)
pretty sure this will be flagged an annihilated
it's idiotic designs like this that feed the ridiculous notion of "JOINS BAD!!! NOSQL GOOOOD!!!" when the RDBMS is a tool in the hands of developers without a clue, then i guess it stands no chance. — swasheck 36 secs ago
 
is it just me or is anyone else bothered when seeing misspelled tags? dba.stackexchange.com/questions/tagged/virtualisation
 
4:36 PM
what misspelling? -isation vs. -ization ?
 
britishism
 
5:03 PM
@bluefeet good thing you don't need him anymore
;-)
 
5:13 PM
I can help.
 
yup, @zane can help (and he is secretely spiderman)
 
And if his help doesn't work, there's always undo --->
 
:)
well it's meetings from here on out.
 
5:49 PM
@bluefeet yuckity yuck
and not just because I prefer keywords in lower case :)
 
@JackDouglas people have their own style. I can imagine the complaints from this
 
people wouldn't be able to read their own code
@ypercube no sure, maybe leave it there now?
 
@bluefeet could be incorporated with my suggestion
 
 
2 hours later…
7:35 PM
<crickets> ... anyone here?
 
just me
 
I'm here too
 
and me
so no one really
 
Anyone care to take a stab at why this is failing on me? sqlfiddle.com/#!3/722567/1
I'm just trying to get a count by month
by agency, as defined by Agency_Case_Submitting_Agency_ID
 
@Daи you don't have aliases for the tables
 
7:37 PM
ahh crap
 
but you are using them anyway
 
@Lamak DUH! thanks so much
sometimes that second pair of eyes helps a lot ;)
 
@Daи no problem
 
@Daи it was only that:
 
7:38 PM
WTG Lormak!
 
lol
 
@Lamak thanks so much!
It's always something silly that trips me up
 
hey, no problem, it literally took a couple of seconds, don't worry about it
 
if it took a few minutes, we'd charge you, @Daи
 
@swasheck I figured as such :P
 
7:45 PM
@Daи also, just in case you wanted to give it a go, you could refactor with this bad mamma jamma
 
did someone say pivot?
 
@swasheck ooh - that does look like some bad mamma jamma there
 
not @Daи
@Daи i think (and @PaulWhite may have to confirm this), but i think that PIVOT is semantic sugar for your pattern anyway. not sure. could be rong. <---- that's rong <--- so's that
 
@swasheck it is
@Daи here is an approach
but the total will be a little more complicated
@bluefeet can help
 
@Lamak sweet
 
7:57 PM
 
@Daи see ... axe a question in here and you'll get more than you bargained for
 
@bluefeet right, exactly like that
 
@bluefeet I was presenting at the Mile High Tech Con when you rang. I assume @zane got you straightened out?
 
@billinkc lame
 
This is true
 
8:00 PM
@swasheck it's great, I'm learning - and it's a refreshing change from many programming language rooms where you're lucky to get any help at all
 
that's because we're awesome
 
@Daи That's why our room name is "The Heap - Consultancy"
 
@Lamak Well, I guess it all revolves around her main point that two equally correct answers should be rewarded (voted) equally and anyone who gives preference to one answer over the other is not being honest in their voting.
 
anyone here good with PowerShell? @MikeFal isnt around and i suspect that neither is @JNK
 
@AndriyM yeah, but to go to say that's gaming the system, that no one should choose one answer, etc. Or that somehow is not the community if you vote
sigh
@swasheck Sorry dude, can't help
 
JNK
8:11 PM
@swasheck I'm here
just lurking and twurking
 
@JNK in the following pattern:
(1..5) | % { --outer
  (15..25) | % { --inner

   }
}
if i wanted to multiple outer * inner
 
@jnk you're welcome
 
@jnk would i have to assign the outer loop to a variable
or is there a shorthand way to $_ * $_
 
JNK
you need to assign a variable
b/c in the inner scope $_ just means inner scope object
 
@Lamak I was surprised by that too. It's as if my personal vote could upset the perfect balance of the community's decision.
 
JNK
8:17 PM
@swasheck so you want all possible products there?
 
@AndriyM right, like one isn't part of the community or it prevents the rest of the people to make their own decissions
 
@JNK that was just an example
 
JNK
but yes you need to assign a var
for those situations I normally use a normal for loop instead of a pipelined foreach
 
$cache_types = @("Cold","Warm");
$estimator_types = @("Legacy","2014");

$estimator_types | % {
    $estimator_type = $_;
    $cache_types | % {
        $cache_type = $_;
        (1..5) | % {
            $run_number = $_;
            Write-Host "$cache_type  $estimator_type    $run_number";
        }
    }
}
 
JNK
ForEach ($a in (1..5))
{
ForEach ($b in (15..25))
{
$a*$b

}

}
$cache_types = @("Cold","Warm");
$estimator_types = @("Legacy","2014");

ForEach ($et in $estimator_types)
{
	ForEach ($Cache in $cache_types)
	{
		ForEach ($n in (1..5))
		{
			Write-Host "$Cache  $et    $n";
		}

	}

}
comme ca?
little bit less to type I think
 
8:22 PM
fair enough
 
JNK
but yeah you need to reassign
 
thanks
 
JNK
except in your example you can leave out the $run_number reassignment and just use $_
 
@JNK true
 
8:33 PM
Ah, I was not fast enough responding to the Powershell signal
 
JNK
Get-signal
 
Oh, jeez, damn
can I ask one of you a favor?
 
@Lamak I probably can't help.. but I'll try :)
 
Please someone edit this question to anonymize the schema
0
Q: sql view with declare

user3447211i need this in a view, but its seems that you cant use declare. help? declare @lastsat datetime set @lastsat = (select max(fechahoy) from [AreaComercial].[LARRA_DOM\Mpollak].[Canales_expandida] where DiaSemana='Saturday') SELECT a.*, case when b.fecha_gestion = a.fechahoy and month(fechahoy...

@Daи this is a....coworker from what I can see
and if I edited out he'll recognize it was me, and I want to avoid a confrontation
 
@Lamak oh I can edit, but it will likely need to be approved
 
8:43 PM
bummer....@swasheck?, @JNK?
 
@Lamak and there are two answers that will also need to be edited
make that 3
 
yeah I see....damn, just what was that guy thinking??
 
@MikeFal hey ... so uhhh ....
not sure how to say it
 
at least someone can comment that he shouldn't post the schema including the username and such
gah!!
 
but uhhhh ... there may be some interesting information in the chat transcript here vis a vis as certain person's abstract on the 2014 cardinality estimator
 
8:47 PM
you probably shouldn't post the schema publicly including the username and such.... — Daи 31 secs ago
 
thanks
 
@Lamak edited out of the question
 
thanks guys
and gal
 
is this a valid q?
4
Q: Estimate projected database growth

diegoxfsI recently started working with SQL Server 2008 as a DBA trainee. I need calculate the size of the database but also estimate its growth over recent months and the predicted growth for the next 12 months. I can use the sp_spaceused statement to calculate the actual size but how do I calculate ev...

referring to
 
9:02 PM
wonder if I should talk to the guy that posted the Q whit his username about it
 
9:14 PM
@Lamak im surprised you don't know him.. you're both from Chile
 
I do know him
he is a "coworker"
he works in another department
 
"i see"
 
I didn't think he would post a question with the username exposed like that. Not that it's too wrong, but in our company that may very well be a cause for termination
 
10:13 PM
@Lamak wait ... huh? i thought you knew the "Estimate projected database growth" guy
 
10:48 PM
@swasheck Put it this way - say we have an AG spread across multiple DCs, in one of our secondary DCs there's two nodes - one of which is an async replica, and the other the server is in the cluster but the DBs are logshipped (so the server's part of the cluster, but the databases technically aren't). If you have all the log backups, you can bring that logshipped copy into the AG, but what happens if you lose a log backup?
i.e. log backup's been taken on the primary, but there's a whole-of-DC outage at the primary before the log backup gets copied to the secondary DC. You can force the AG onto the async replica, but could you then take a log backup (from the formerly-async-replica-now-primary) and use that to replace the missing log on the logshipped copy?
 
11:10 PM
@SimonRigharts sounds dicey. I suppose you could as long as no other restores had occurred. Wouldn't and out-of-sync log restore poop the bed anyway?
An. Stupid mobile chat pos
 
@swasheck Yeah I'm not sold on it working myself. I just haven't had a chance to test it yet. I guess a diff backup would work, though?
 

« first day (1298 days earlier)      last day (3563 days later) »