32,383 karma · joined Jan 3, 2008 (18y ago) · 8,295 submissions
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
I asked an llm to give me an ascii representation so it'll be easier to see what I mean; consider the case where you want thing_date < 17 and thing_color = blue, the results that match are marked with an asterisk, but note that there's no way to get to them (ALL of them) directly:
Root (internal)
+---------------------+
| keys: 14 17 |
+----+--------+--------+
| | |
v v v
+----------------+ +----------------+ +----------------+
| Leaf P0 | | Leaf P1 | | Leaf P2 |
| (dates 10-13) | | (dates 14-16) | | (dates 17-20) |
|----------------| |----------------| |----------------|
| 10 | red |101 | | 14 | blue |141| | 17 | green |171|
| 11 | blue |111 |*| 14 | red |142| | 18 | blue |181|
| 12 | green |121 | | 15 | yellow|151| | 19 | red |191|
| 13 | red |131 | | 16 | blue |161|*| 20 | green |201|
+----------------+ +----------------+ +----------------+
Go back to my resume's example: you have the resumes sorted by application timestamp (chronologically) and position (alphabetically). You want to find all resumes received last Tuesday where position was "Senior Architect". You literally can't skip to the point where the next n consecutive results will be the results you seek, because you can't temporarily re-order them and within the subset of resumes where date > monday and date < wednesday, there may be multiple for "Senior Architect" but they didn't arrive one-after-the-other so they're interspersed with results you don't want. The correct to do here would be (if this is always the shape of the query you expect to get) to sort the resumes by (position, timestamp) instead, at which point you absolutely CAN jump to the position that guarantees the next results are (all the results) of the query ("Senior Architect", last Tuesday).One important thing to keep in mind is that a SCAN is not the end of the world. You know your data and you know when it's ok (you expect most of the results to match and a few to be filtered out, in which case you're really not saving much time anyway) and when it's not (the scan will cover a huge range that contains only a few, widely interspersed results and you have no way of terminating early).
EDIT: In response to your exact question however, note that with a covering index you might not end up with a SCAN (i.e. you don't hit the table) even though it uses only the partial index (thing_date) and not (thing_date, thing_color)! It's still possible for it to avoid hitting the backing table and might return the results directly from the index - something it wouldn't have been able to do if the index was only (thing_date).
comment 1y ago · link · parent
If you understand what (multi-column) indexes are at the lowest level (i.e. what data structure they represent, how they are used by the database, what the code reading them would look like) then all of this makes immediate and natural sense. Indexes aren't magic. They're just a shortcut to help the the db engine find your data more effectively.
This doesn't require super complex understanding of data structures, btw. The same limitations and advice would apply if you were trying to, for example, search a stack of resumes sorted by one or more attributes. If you have them sorted by position, years of experience, and applicant's last name; you wouldn't be able to quickly grab all resumes for the HR Manager position that have a last name starting with J - after all, you sorted them by years of experience first! It's physically not possible! You can only use the first part of that index, the position, to jump to HR Manager resumes; then you would need to manually go through them one-by-one to grab only the ones starting with J for each years-of-experience subgroup (if any).
comment 1y ago · link · parent
* I love the writing, it's witty and poignant
* I was impressed that WASD controls worked with my keyboard set to Dvorak :)
* Unfortunately have to second the comments about nausea; the oddly paced camera (it feels like it is panning through molasses then suddenly accelerates to switch views) is probably responsible, I'm guessing the "overshoot view then correct" "feature" is also a factor. Additionally seconding the comments about allowing the camera to follow the mouse (if feasible somehow while not losing cross-form-factor support) would go a long way to help here as well.
* The font that shows you where you are is cute in an orientalist sense, but imho it is very difficult to read (even knowing what it says from context clues and previous hints)
* Not a criticism but it is odd to have jumping when there is no mechanism that uses it in-game
* 99.99% a me problem: I had a hard time with spatial awareness and a difficulty building a mental map of the world and my best guess is that it's because I personally found the default field of view to be too "zoomed in".
comment 1y ago · link · parent
For non-performance-sensitive code, sure, go ahead and rely on the rust compiler to compile away the allocation of a whole new vector of a different type to convert from T to AtomicT, but where the performance matters, for my money I would go with the transmute 100% of the time (assuming the underlying type was decorated with #[transparent], though it would be nice if we could statically assert that). It'll perform better in debug mode, it's obvious what you are doing, it's guaranteed not to break in a minor rustc update, and it'll work with &mut [T] instead of an owned Vec<T> (which is a big one).
comment 1y ago · link · parent
A suggestion: in the comparison table under the “AES and Port-Parallelism Recipe” it would be great to include “streaming support” and “stable output” (across os/arch) as a column.
Also something to beware of, some hash libraries claim to support streaming via the Hasher interface but actually return different results in streaming and one-shot mode (and have different performance profiles). I’m on mobile so I can’t check atm but I’m about 80% sure gxhash has at least one of these problems that prevented me from using it before.
comment 1y ago · link · parent
I'm not even anti-datacenter (wouldn't be here if I were), I just think there needs to be serious rebalancing of these costs because this increase in US residential electric prices in just five years (from 13¢ to 19¢, a ridiculous 46% increase) is neither fair nor sustainable.
So where is this 10GW electric supply going to come from and who is going to pay for it?
Source: https://fred.stlouisfed.org/series/APU000072610
EDIT:
To everyone arguing this is how DCs are normally sized: yes, but normally it's not the company providing the compute for the DC owner that is giving these numbers. nVidia doesn't sell empty datacenters with power distribution networks, cooling, and little else; nVidia sells the GPUs that will stock that DC. This isn't a typical PR netnewswire bulletin "OpenAI announces new 10GW datacenter", this is "nvidia is providing xx compute for OpenAI". Anyway, all this is a segue from the question of power supply, consumption, grid expansion/stability, and who is paying for all that.
comment 1y ago · link · parent
Also, I wouldn’t have known the product exposes an API I could use to programmatically get the (XML-only?) usage data in realtime over the network if you hadn’t told me, the product listing makes it look like it’s just a screen (and the faq doesn’t have anything about connecting to the device programmatically).
Anyhow, thanks for brining this to my attention! This might be exactly what I was looking for!
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
Do note that if you purchase an RTL-SDR these days, you'll probably get a v4 which, at least as of last year, does not play out-of-the-box at all with the software available on the Ubuntu apt repos and the RTL-SDR drivers that ship with 24.04 out-of-the-box — there were some hardware protocol/interface changes between v3 and v4 that make the old drivers incompatible and you'll get a litany of misleading or non-specific errors if you try without downloading and installing the latest drivers from GitHub (or somewhere).