Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Flat Daddy
Dec 3, 2014

by Nyc_Tattoo
we use hang fire to queue up tasks from our webapi app. the tasks are also c# but they're compiled into exe's and checked into our tree

Adbot
ADBOT LOVES YOU

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo
the engineer who did it used the goon in a well development methodology

cinci zoo sniper
Mar 15, 2013




tp question about updating sql tables.

when i know what rows and fields i want to update, its p clear how and what. what if i have a table with dynamically, recursively updating values in previous columns? is there a better way to figure out the updates than to compare the updated table (entire table is returned by query) with the stored query result table - when it would make much more sense to just overwrite it?

tef
May 30, 2004

-> some l-system crap ->

cinci zoo sniper posted:

recursively updating values in previous columns?

when you cut against the grain there isn't a good way to go about it

cinci zoo sniper
Mar 15, 2013




tef posted:

when you cut against the grain there isn't a good way to go about it

got it, cheers. ill just overwrite the entire table then, its not much

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

cinci zoo sniper posted:

tp question about updating sql tables.

when i know what rows and fields i want to update, its p clear how and what. what if i have a table with dynamically, recursively updating values in previous columns? is there a better way to figure out the updates than to compare the updated table (entire table is returned by query) with the stored query result table - when it would make much more sense to just overwrite it?
I think we need more details on this one.

As for when it would make sense to completely overwrite the table? Almost never.

cinci zoo sniper
Mar 15, 2013




Lady Gagas Penis posted:

I think we need more details on this one.

As for when it would make sense to completely overwrite the table? Almost never.

im thinking now myself, if i really can't define a condition when a row will become immutable. ill need to check with coworker tomorrow, he devised this algorithm. if he wrote it through fixed starting point, the i guess i can just query for the incomplete rows, since those all are separate aggregation units, and then update them in a straightforward fashion (i intend storing aggregate of one table in a different table)

now if the starting point is floating the it's balls. there's no definable end state, and data changes arbitrarily withing a very loosely defined timeframe. with the number of checks for changes than id need to do, overwriting seems like the only rational option

ShimaTetsuo
Sep 9, 2001

Maximus Quietus

cinci zoo sniper posted:

tp question about updating sql tables.

when i know what rows and fields i want to update, its p clear how and what. what if i have a table with dynamically, recursively updating values in previous columns? is there a better way to figure out the updates than to compare the updated table (entire table is returned by query) with the stored query result table - when it would make much more sense to just overwrite it?

you mention "previous columns", but the relational algebra really has no concept of column or row ordering. so you're going to have a bad time trying to access a "previous column" when all the SQL verbs talk in terms of bags of objects with unordered properties.

didn't you mention storing time series as rows in another post, with times as columns? is that really a thing people do? a performance optimization when you always want to query the whole series maybe? seems like it would be a pain to update.

cinci zoo sniper
Mar 15, 2013




ShimaTetsuo posted:

you mention "previous columns", but the relational algebra really has no concept of column or row ordering. so you're going to have a bad time trying to access a "previous column" when all the SQL verbs talk in terms of bags of objects with unordered properties.

didn't you mention storing time series as rows in another post, with times as columns? is that really a thing people do? a performance optimization when you always want to query the whole series maybe? seems like it would be a pain to update.

previous rows, my bad - even though it doesn't change much. and yeah, it's time series aggregates that in our case are helpful to monitor how well we are doing as a business

cinci zoo sniper
Mar 15, 2013




can someone link me that series of blog entries about sql explain entries that got posted to yospos recently? at least i think they were, but i cant find them (not https://use-the-index-luke.com/) and the loving microsoft edge i used at work is not helpful in digging it up in history

e: found it https://www.depesz.com/2013/04/16/explaining-the-unexplainable/

cinci zoo sniper fucked around with this message at 08:29 on Dec 4, 2017

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
yeah i posted that a little while ago and i highly recommend it, the dude's english isn't 100% perfect but you can understand what he's saying and he goes into detail

cinci zoo sniper
Mar 15, 2013




DELETE CASCADE posted:

yeah i posted that a little while ago and i highly recommend it, the dude's english isn't 100% perfect but you can understand what he's saying and he goes into detail

cheers! and don't worry about my familiarity with broken english :v:

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
regarding your update vs overwrite question, i'm not sure if the time series points matter here. you are going to modify a bunch of rows. if it's only a few then it will be faster to do individual updates. if it's every single row then it's faster to rewrite the whole table. the line between the two is not clear, i guess you'd have to experiment and benchmark. note that for large updates you may also be spending a lot of time updating indexes or checking constraints. in that case it is often faster to drop those, run the update, and recreate them again. thankfully postgres has transactional ddl

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
also i'm guessing you already know this but given the amount of people in the history of my company (judging from its codebase) who did not...

this is slow:
code:
for id in sql("select key from some_table where update_condition"):
  sql("update other_table set value = new_value where key = $id")
this is faster until you have too many ids and then the planner nopes out and it becomes very slow (you can batch it but c'mon just stop):
code:
ids = sql("select key from some_table where update_condition")
sql("update other_table set value = new_value where key in ($ids)")
also in most old java poo poo code they can't pass an array parameter nicely so that query is probably made with string concatenation lol

just do this:
code:
sql("update other_table ot set value = new_value from some_table st where st.key = ot.key and update_condition")
of course if you can't select the rows you want to update this way, and your table is just a reflection of data from some other source that you need to update row by row, then this doesn't help you

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat

Flat Daddy posted:

the engineer who did it used the goon in a well development methodology

i googled goon in a well and the first hit was a pastebin thing that described this perfectly

cinci zoo sniper
Mar 15, 2013




i don't know anything, this literally is the first time i'm going beyond a select statement - if me being the most frequent poster itt hasn't convinced you already

as for update vs overwrite, i had a brief meeting with the author of the scripts i'm storing, and there indeed is no way to logically describe the update condition. hence, delete table every time all the time.

i'll still keep your advice though, in case ill foray further into non-select database things. i'd definitely do the second variant every time and just shrug were it to fail

gonadic io
Feb 16, 2011

>>=

CRIP EATIN BREAD posted:

i googled goon in a well and the first hit was a pastebin thing that described this perfectly

Because I had to google it too: https://pastebin.com/F83ZG2L6

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

gonadic io posted:

Because I had to google it too: https://pastebin.com/F83ZG2L6
it's been in the saclopedia for almost nine years https://forums.somethingawful.com/dictionary.php?act=3&topicid=2189

Soricidus
Oct 21, 2010
freedom-hating statist shill
i found myself reading stl header files today

life tip: never do this

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

st-hell, sounds like

Star War Sex Parrot
Oct 2, 2003

writing a file system in FUSE is fun

got a nice Amazon S3-backed hybrid cloud file system going here with data deduplication. working on snapshots now

Luigi Thirty
Apr 30, 2006

Emergency confection port.

well i did it, i wrote a signed division wrapper around the jag gpu's unsigned fixed-point division instruction and set up perspective divide of a triangle. it took me 2 evenings. i'm going to go do anything other than programming now

Shaggar
Apr 26, 2006
play some factorio, imo.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Shaggar posted:

play some tis-100, imo.

pseudorandom name
May 6, 2007

Soricidus posted:

i found myself reading stl header files today

life tip: never do this

clang has really nice STL headers and then you realize the template definition you're reading is actually a pleasantly formatted comment and the real defintion is a creeping horror later in the file

Luigi Thirty
Apr 30, 2006

Emergency confection port.

okay, i lied, i had to just finish the feature i was working on

https://twitter.com/LuigiThirty/status/937917925557665792

FamDav
Mar 29, 2008

Star War Sex Parrot posted:

writing a file system in FUSE is fun

got a nice Amazon S3-backed hybrid cloud file system going here with data deduplication. working on snapshots now

is it immutable or do you have a separate metadata store

jesus WEP
Oct 17, 2004


Luigi Thirty posted:

well i did it, i wrote a signed division wrapper around the jag gpu's unsigned fixed-point division instruction and set up perspective divide of a triangle. it took me 2 evenings. i'm going to go do anything other than programming now
take a walk in some nature

cinci zoo sniper
Mar 15, 2013




c tp s:

TimWinter
Mar 30, 2015

https://timsthebomb.com
What is c tp s

jesus WEP
Oct 17, 2004


current tp status

cinci zoo sniper
Mar 15, 2013




TimWinter posted:

What is c tp s

c tp p s

cinci zoo sniper
Mar 15, 2013




speaking of, im now trying to think, not too hard, about optimal indices for enum and char(n) columns

gonadic io
Feb 16, 2011

>>=

TimWinter posted:

What is c tp s

Current Terrible Programmer(ing?) Status

It's a riff on Current Job Status, I. E. The cjs thread

Sapozhnik
Jan 2, 2005

Nap Ghost

cinci zoo sniper posted:

speaking of, im now trying to think, not too hard, about optimal indices for enum and char(n) columns

an index with worse (numerically higher) selectivity than 1% isn't really worth using

not sure if that's the official term or metric for it but you get what i'm saying hopefully.

cinci zoo sniper
Mar 15, 2013




Sapozhnik posted:

an index with worse (numerically higher) selectivity than 1% isn't really worth using

not sure if that's the official term or metric for it but you get what i'm saying hopefully.

i didn't get anything. that means b-tree?

Sapozhnik
Jan 2, 2005

Nap Ghost
If an index doesn't cut a query's search space down to 1% of the table's size or less then it isn't worth creating and maintaining.

An enum doesn't sound like the sort of column that has a lot of distinct values relative to the size of the table, so the best kind of index to use on an enum column is no index at all.

As with all things database though, it depends on the workload.

cinci zoo sniper
Mar 15, 2013




Sapozhnik posted:

If an index doesn't cut a query's search space down to 1% of the table's size or less then it isn't worth creating and maintaining.

An enum doesn't sound like the sort of column that has a lot of distinct values relative to the size of the table, so the best kind of index to use on an enum column is no index at all.

As with all things database though, it depends on the workload.

workloads are laughable so i wont bother then, cheers

minato
Jun 7, 2004

cutty cain't hang, say 7-up.
Taco Defender
This story triggered my impostor syndrome pretty hard: https://marcan.st/2017/12/debugging-an-evil-go-runtime-bug/

The TLDR is: guy sees an intermittent segfault in a Go program, chases it down to a piece of bad RAM, then realizes that's not the core issue so he chases it down further to a kernel/compiler issue.

But I felt the sheer breadth and depth of knowledge required to do all that was pretty impressive. I'd probably have welp'd out at "My Go program segfaults, file a bug".

Adbot
ADBOT LOVES YOU

Sapozhnik
Jan 2, 2005

Nap Ghost

minato posted:

This story triggered my impostor syndrome pretty hard: https://marcan.st/2017/12/debugging-an-evil-go-runtime-bug/

The TLDR is: guy sees an intermittent segfault in a Go program, chases it down to a piece of bad RAM, then realizes that's not the core issue so he chases it down further to a kernel/compiler issue.

But I felt the sheer breadth and depth of knowledge required to do all that was pretty impressive. I'd probably have welp'd out at "My Go program segfaults, file a bug".

if i had to choose between blaming code that i wrote and blaming a bug in, say, gcc, then yeah it's probably a bug in my code.

if there's weird crashes in a go program on the other hand then yeah i'd totally be a bit more inclined to believe that rob "I Am Very Smart" pike hosed something up

lol if you ever rely on go

  • Locked thread