Solving one of PostgreSQL's biggest weaknesses.

  Рет қаралды 221,892

Dreams of Code

Dreams of Code

Күн бұрын

Пікірлер: 299
@dreamsofcode
@dreamsofcode Жыл бұрын
To get started with a free trial of TimeScaleDB use the following link! console.cloud.timescale.com/signup/?
@NostraDavid2
@NostraDavid2 Жыл бұрын
Note: I hope you've pulled down those instances, because I see a few passwords in the video. Seeing the complexity, I presume it's a single-use password, generated by a password manager?
@dreamsofcode
@dreamsofcode Жыл бұрын
@@NostraDavid2 They're down :) thank you for checking though!
@ftamas88
@ftamas88 Жыл бұрын
would love to see a more in-depth one about compression and the others :o
@tomasruzicka9835
@tomasruzicka9835 Жыл бұрын
LOGLINES: loglines are a great example of time series data. It's also usually some dynamic object with a timestamp.
@jirehla-ab1671
@jirehla-ab1671 Жыл бұрын
​@@dreamsofcodehave u tried edb postgres?
@marcoscarvalho660
@marcoscarvalho660 Жыл бұрын
In Postgre we trust
@realscience7274
@realscience7274 Жыл бұрын
It's bloated and slow. F SQL.
@isaacfink123
@isaacfink123 Жыл бұрын
​@realscience7274 what's the alternative?
@spicynoodle7419
@spicynoodle7419 Жыл бұрын
​@@isaacfink123MySQL/MariaDB and better architecture
@FunctionGermany
@FunctionGermany Жыл бұрын
@@isaacfink123 spend 20 man years engineering your own database system with rust, obviously.
@anarcus
@anarcus Жыл бұрын
​@@FunctionGermanyexactly, SurrealDB
@FunctionGermany
@FunctionGermany Жыл бұрын
i gotta respect your dedication to reading and replying to criticism and question in the comments. when this channel grows more you're not gonna be able to keep up with all comments but if you keep doing this amount of work i think you'll maintain high integrity and trust. i've seen a bunch of promising tech channels dip their toes too far into the sponsor or hype train pond, releasing content without enough reflection or community consultation (e.g. joshtriedcoding). i'm looking forward to your future content :)
@dreamsofcode
@dreamsofcode Жыл бұрын
Thank you! I'm definitely taking the feedback on board and working out solutions for future content. After any sponsorship commitments I'm currently dedicated to, I'll be taking a pause on them in order to work out how best to proceed. I have a couple of solutions in mind so will share them with the community when they become more fleshed out.
@savire.ergheiz
@savire.ergheiz 8 ай бұрын
Poor josh only tried hence the channel name. So nothing wrong he only delivers what he promised 😂
@FunctionGermany
@FunctionGermany 8 ай бұрын
@@savire.ergheiz sometimes josh REALLY doesn't try hard at all unfortunately. he's dropped some pretty massive L's in the past.
@stephenreaves3205
@stephenreaves3205 Жыл бұрын
Also worth pointing out that while p95 time was smaller going to hyper table, the p95 memory went up by a lot
@dreamsofcode
@dreamsofcode Жыл бұрын
Great call out!
@projekt95
@projekt95 Жыл бұрын
Does the memory size correlate with the chunk size (chunk_time_interval) of the hypertable? So a smaller chunk size with lots of input is better to save memory usage?
@mmkumars
@mmkumars 10 ай бұрын
3MB to 3GB
@ua420
@ua420 2 ай бұрын
Exactly I was expecting for explanation going from 31MB to 32GB
@guiorgy
@guiorgy Ай бұрын
12:06 3.2 MB to 3.1 GB, WDYM 32 GB?
@daves.software
@daves.software Жыл бұрын
Did you have an index on the started_at column for the regular table?
@JohnPruitt-p1n
@JohnPruitt-p1n Жыл бұрын
This is great! One point of feedback: instead of writing each parquet file out to disk as a csv, and then COPYing from the csv file, try converting the parquet file to csv and streaming it directly into the STDIN of the COPY command. Forego the reading and writing to disk. I expect this to speed up your load script considerably.
@virennjay2088
@virennjay2088 5 ай бұрын
Subscribed to your channel 5 minutes into this video. Learnt a lot just from setting up the environment for this. Love how easy to follow and replicate the steps were.
@JimCarnicelli
@JimCarnicelli Жыл бұрын
Excellent introduction. Thank you.
@charlesm.2604
@charlesm.2604 Жыл бұрын
This channel is slowly becoming my favorite place on the internet
@Stublet
@Stublet Жыл бұрын
Thank you for this video. As it happens I was thinking about looking into timescale as well as influx and a few other time time series dbs out there. Postgres is not my favorite db of choice, but I"m a big proponent of using the right tool for the job and timescale checks a lot of my boxes here. Also props for featuring neovim. :)
@themarksmith
@themarksmith Жыл бұрын
Excellent video, would love to see more on TimeScaleDB!
@dreamsofcode
@dreamsofcode Жыл бұрын
It's a really cool extension! I shall probably do a video on self hosting it next
@themarksmith
@themarksmith Жыл бұрын
@@dreamsofcode v interested in self hosting!!!
@ilyapunko1127
@ilyapunko1127 Жыл бұрын
We are using timescale db in prod. But, actually, this solution has a lot of problems yet. You can check issues. But anyway it's pretty simple and affordable variant for timeseries.
@mikopiko
@mikopiko Жыл бұрын
Have you tried ciickhouse yet?
@dreamsofcode
@dreamsofcode Жыл бұрын
What issues are you currently facing? We're using it in production as well and have had a good experience so far.
@vslabs-za
@vslabs-za Жыл бұрын
Interesting, thanks. My big data table is more than a few TB and over 90 billion (no typo) rows. But it's in that "dreaded vendor database", Oracle. It's a 2 node Oracle database cluster on 2017 h/w, processing and analysing over a billion WAN IP traffic flows per day (SQL & PL/SQL code). Would love to try out PostgreSQL though. But then there's my other pursuits (like machine learning on IP traffic for anomaly detection)... and not enough hours in a day. This is a great time for s/w engineers. So many fascinating technologies, products, languages, and concepts to explore. The Golden Age of Software Technologies. 🙂
@jonatasdp
@jonatasdp Жыл бұрын
Yayyy! Definitely Golden Age Timescale was dogfooding and reached 10 billion records per day in a single node, single hypertable :)
@lhxperimental
@lhxperimental Жыл бұрын
In older versions of Postgres you had to use table inheritance to achieve partioninging. But since last several years, they have declarative partitions although you still have to create the partition tables yourself.
@MuratcanBerber
@MuratcanBerber Жыл бұрын
There is an extension called pg_partman that can help creating partitions automatically. We also use timescaledb in our Production databases to deal with time series data. Another think I want to mention that, creating a dummy timestamp data it isn't that hard. You don't need to download anything. You can use PostgreSQL generate_series() command which can accept start and end_time and use random numeric values for any time range.
@coderentity2079
@coderentity2079 Жыл бұрын
Great! Just what my fellow programmer needed.
@TLAngus1337
@TLAngus1337 Жыл бұрын
Looks interesting, but in your performance comparison you could have added an index on started_at to the normal postgres table. I think that would have increased its query speed substantially (albeit increasing storage)
@dreamsofcode
@dreamsofcode Жыл бұрын
A well designed index can definitely help, although it does impact write performance as well, which in time series data sets can cause issues. You can also add them to hyper tables, if needed. Generally, partitioning is always going to be better for time series and then adding indexes for other features is the best approach in my experience.
@hheheks
@hheheks Жыл бұрын
@@dreamsofcode Yes, but your comparison here is very unfair. Calling create_hypertable() function actually creates an index automatically on the column that you use for time partitioning, which in your case is the started_at column.
@dreamsofcode
@dreamsofcode Жыл бұрын
@@hheheks I hear you, but I think there is a big difference still. Hypertables don't create indexes, only partitions. The issue with just using an index on the start time is that there's still a row lookup. It won't have all the necessary data for aggregations and would require a row lookup still (unless you use the include keyword on the columns you want in the index). You also have to re-balance the index for every insert, which will cause much slower insertion times. I think it's incorrect to compare the two because of the nuances with indexing, which honestly could be a video by itself. I'm happy to do a video to explain the drawbacks of indexing vs partitioning.
@hheheks
@hheheks Жыл бұрын
@@dreamsofcode You are incorrect. create_hypertable() has argument ’create_default_indexes’ which defaults to true, and you are not overriding it. Go check your partitioned table. The parent table does not have the index, but each partitioned chunk has.
@dreamsofcode
@dreamsofcode Жыл бұрын
@@hheheks You're correct. That's my mistake. Let me run this without the create_default_indexes flag and share the findings!
@Terandium
@Terandium Жыл бұрын
So, self hosting for FREE is too much work.. using a docker image is also to much work? So lets use this way more expensive cloud instance that totally isn't sponsoring me...
@SXsoft99
@SXsoft99 Жыл бұрын
My ex "IT guy" that was managing servers was so lazy or I don't know what he was but for him to copy pasting 7-10 console commands was sooo hard it was literally hes job, after 2 days of him not doing anything i was like "give the me god damn connection credentials and root access" 1 day later after just a bit of research i finished putting up the entire scaffolding, and documented it since some people find it hard to "google it" I dont know if its a trend or people just want everything on a plate but learning is hard, thinking is hard, breathing is hard
@dreamsofcode
@dreamsofcode Жыл бұрын
It's good to be skeptical. However in this case you've missed the point. Yes, Timescale sponsored the video, but they had 0 decision making on how I deployed timescale. I even left links for other deployment models in the project readme. I went with what would be the quickest for the video. The hypervisor on macOS would skew the results, and setting up an instance of timescale would detract from the content. If that's something people are interested in, I'm happy to do another video on it.
@Terandium
@Terandium Жыл бұрын
@@dreamsofcodeThanks for the reply, in. the case of the video I totally get it. I think it's very cool you pointed out the free possibilities as well. Just the wording about it sounds quite off to me haha, and to my friend as well. its how I got to this video in the first place. Either way, thanks for the reply as it provided a lot of context.
@dreamsofcode
@dreamsofcode Жыл бұрын
@@Terandium Thank you for the feedback, I really do appreciate hearing your thoughts! I should have done a better job to explain my reasoning for choosing the managed service.
@Kanikkl
@Kanikkl Жыл бұрын
Awesome demo! Thank you! This really opens up another technological layer to me. In the past I had no connection to db optimization other than using indexes in mysql. But this is so much more and so useful! This is actually applicable to an use case that has been bugging me for years. Different type of timeseries data that we are currently cashing through a php scheduler in a redis storage. Will share this with the team 🎉
@dreamsofcode
@dreamsofcode Жыл бұрын
That's great to hear! I'm glad the video was helpful! ❤️
@hansiboy5348
@hansiboy5348 Жыл бұрын
Lovely video! I would love to see this used in a project using sensor data or another type of real time data
@dreamsofcode
@dreamsofcode Жыл бұрын
That's a great use case for it. At my current place of work, we use it for sampling IP attributes over time.
@FunctionGermany
@FunctionGermany Жыл бұрын
i think you're a good guy but if you make a "sponsored" video about a product only because they are sponsoring you i consider this entire video to be an advertisement. usually a sponsored video has a sponsor segment about a product that is unrelated or only tangentially related to the video's content, but here, the entire video is the segment.
@randomgamer518
@randomgamer518 Жыл бұрын
Yea I'm a fan of the channel but I skip all of these sponsored videos entirely
@dylanelens
@dylanelens Жыл бұрын
I agree with this. It feels like watching 17 minute add. It might not BE a 17 minute add but my brains thinks it is.
@darkcraftsman
@darkcraftsman Жыл бұрын
to be fair he said they sponsored it from the beginning and that he actually uses dispite the sponsorships. I don't see anything wrong or unethical here. Maybe a bigger call out to it being sponsored might easy your issues? I personally found this to be quiet help and relevant for me and as long as there is a free/open source self hosted option for any of the products I'll always come back for more.... Just MHO
@randomgamer518
@randomgamer518 Жыл бұрын
I never said it's wrong or unethical, I'm just not a fan. Whenever I see something sponsored, I skip the segment. If the whole video is a sponsored segment, I skip the video.
@cheebadigga4092
@cheebadigga4092 Жыл бұрын
Why? I personally think that videos featuring sponsor segments that have nothing to do with the video are stupid. Why would a psql video not feature a psql-type sponsor, if the sponsor actually has a product worth advertising for? Seems to me like a perfect fit! And, by extension, you're saying you would've watched or cared for the video much more if it was exactly the same content without him mentioning the sponsor? That's beyond weird tbh
@muttBunch
@muttBunch 5 ай бұрын
I can't seem to find what I need, maybe it's explained in here as I continue the video. But what I'm wondering, is, can I have a mix of time series and relational tables in the same DB? Example, I have a table that is storing accounts and has nothing to do with time but I also have a table that's capturing logs, which do include timestamps. The logs table is 51gig at the moment and it's taking almost 30 minutes to query 13million records in SSMS if I want to see all of the data. I can imaging if it's taking that long, how much more time it would take to display the data with EntityFrame work to output in my web app. I've tried to ask similar questions on Stack Overflow, etc, but then I get yelled at such as "Why are you querying everything". I'm providing a way for my team to look at all logs generated from servers based on event IDs and storing them for 6 months.
@LeeStoneman
@LeeStoneman Жыл бұрын
Fascinating insight into large dayda issues.
@oscarljimenez5717
@oscarljimenez5717 Жыл бұрын
Will Timescale be the Planetscale for PostgreSQL? Or the Vitess ?
@dreamsofcode
@dreamsofcode Жыл бұрын
Planetscale is pretty cool! You certainly can use timescale as just a managed PostgreSQL, although it's more optimized for time series data.
@jonatasdp
@jonatasdp Жыл бұрын
Timescale now also offering Dynamic Postgresql instances. Announced this week, just pay storage for what you use ;)
@rembautimes8808
@rembautimes8808 6 ай бұрын
An excellent video and got me interested in time scale db. Solves a very pressing issue and look forward to more videos. To me if you’re providing value to data analysts and those tasked with solving complex business problems. If a tool provider does it well no harm in showcasing it
@dreamsofcode
@dreamsofcode 6 ай бұрын
Thank you! I'm a big fan of TimeScale personally as well, we've used them to solve some large time series problems!
@spartan_j117
@spartan_j117 Жыл бұрын
12:03 what does "P95 memory" metric means?
@jdmichal
@jdmichal Жыл бұрын
P95 means "95th percentile". So 95% of observed values are = that value. So P95 memory consumption would mean that 95% of the runs consumed the same or less memory. 5% consumed the same or more memory.
@smithrockford-dv1nb
@smithrockford-dv1nb Жыл бұрын
Am I reading the data wrong or has the hypertable used waaaaay more ram at 12:09? The difference between 0.0032GB and 3.1GB (x968) is not be just glanced over in my opinion...
@dreamsofcode
@dreamsofcode Жыл бұрын
You're correct, it does use a lot more RAM, but that's by design due to the way hypertables cache their data in memory. That could be seen as a negative, but in comparing timings, using RAM is a good thing imho as it allows for optimizaton. However, I should have called this out on the video. Thank you for raising it!
@and_rotate69
@and_rotate69 Жыл бұрын
I think you forgot to point out that spliting a table into partitions requires more storage, i believe u did point this in the last video but the storage in question isn't small to be ignored
@dreamsofcode
@dreamsofcode Жыл бұрын
That's a fair point, but compared to other solutions such as indexing the storage impact is pretty minimal. It's no where near 2xing or anything like that and given storage is pretty cheap, its a fair trade off IMHO.
@and_rotate69
@and_rotate69 Жыл бұрын
​@@dreamsofcodei agree, i'd rather pay like 1$ for like 30 to 35gb of storage than a pile of money for some compute time
@dreamsofcode
@dreamsofcode Жыл бұрын
@@and_rotate69 I do think it's worthwhile me doing a video on indexing as there's a few other comments about it as an option. Appreciate the feedback as well!
@keyboard_g
@keyboard_g Жыл бұрын
If you previously indexed by the partitioning field, that can then be dropped which can buy back space, and compute time on inserts.
@wembleyleach
@wembleyleach 8 ай бұрын
Thanks for the awesome video!
@kampanartsaardarewut422
@kampanartsaardarewut422 Жыл бұрын
can traditional postgres brin index achieve the same goal?
@dreamsofcode
@dreamsofcode Жыл бұрын
Indexing would help, but it won't help for every query. Partitioning tends to be the better option for timeseries, however. This is due to not needing to rebalance any indexes when insert or update more data.
@mrCrashCube
@mrCrashCube Жыл бұрын
Verry nice Video! Thank you! at 9:30 you declared a reference in a hypertable, that is not working for me. after consulting google i found out that in hypertables it is not possible to create references... how did you solved that?
@ArunGordon
@ArunGordon 5 ай бұрын
This is some quality content.
@myt-mat-mil-mit-met-com-trol
@myt-mat-mil-mit-met-com-trol Жыл бұрын
I wonder how timescaledb would work with postGIS extension
@spartan_j117
@spartan_j117 Жыл бұрын
Thanks for the video. But don't you know about "\timing" in psql?
@dreamsofcode
@dreamsofcode Жыл бұрын
Great tip!
@ivanmaglica264
@ivanmaglica264 Ай бұрын
So does that basically mean that table gets broken into multiples and is queried in parallel?
@yassinebouchoucha
@yassinebouchoucha 5 ай бұрын
more advanced reportings on that data, Also could you make example using compression and hyperfunctions ?
@rdatta
@rdatta Жыл бұрын
Excellent introduction to TimescaleDB. Would very much like to see more features and capabilities.
@rebelwwg1wga431
@rebelwwg1wga431 11 күн бұрын
what about citus cluster?
@ducseul
@ducseul Жыл бұрын
can I get the keywords for setup the desktop environment as video do ? Thanks
@ragectl
@ragectl Жыл бұрын
Smooth inclusion of the number of KZbin subscribers. I am convinced 👍😉
@bryce.ferenczi
@bryce.ferenczi Жыл бұрын
12:35 bro really clocked $168 of usage with a "hello-world"
@sandworm9528
@sandworm9528 Жыл бұрын
Jeeeesus
@FlorianWendelborn
@FlorianWendelborn Жыл бұрын
Using Timescale for Skyblock Finance and loving it so far. It’s a bit complicated to set-up the continuous aggregates properly but once it's running it's a lot faster
@dreamsofcode
@dreamsofcode Жыл бұрын
Just checked it out, very cool!
@Povanky
@Povanky 8 ай бұрын
Hi, do you have any suggestions how to improve speed of full text search combined with filtering on other columns? Table size is more than 600Gb, filtering columns are provided by user and are different each time
@Povanky
@Povanky 8 ай бұрын
Stored tsvectors with indexing are fast, but when it's combined with other column filters performance become really bad
@awakenwithoutcoffee
@awakenwithoutcoffee 3 ай бұрын
@@Povanky can't you utilize indexes on regular non-vectorized columns ? also have you looked into PGvector, pgvectorscale and pgai ? . pgvector provides the vector data type and HNSW search index. Pgvectorscale provides the StreamingDiskANN index to superpower embedding search and make vector queries performant. Pgai allows you to easily call AI embedding and generation models from inside the database.
@herozero777
@herozero777 11 ай бұрын
Hi really loved the video you've made. It is quite informative. I had one question, what does database migrations do (at 10:00) if not load the data into the new database? Is it in this case just setting up tables in the database instance?
@dreamsofcode
@dreamsofcode 11 ай бұрын
Yes! The migrations just set up the table schemas rather than loading the data in. You can do this in the migration step, however migrations sometimes run in a txn which would probably be quite large.
@richardbennett4365
@richardbennett4365 Жыл бұрын
How does the window get those baby blue, peach, pink, and green colors in the information bar?
@dinoscheidt
@dinoscheidt Жыл бұрын
Yeah, at our start-up (solar analytics) timescaleDB broke completely down, stopped auto sizing so we needed to migrate very quickly to HBase like tesla uses. Became evident, that MS did not test their product at more than almost big data size data.
@jonatasdp
@jonatasdp Жыл бұрын
That's a sad experience Dino. Just curious, what's the size of your database? We ( I work for Timescale) recently reached 10B rows per day and our dog fooding project. The storage is over 350TB at this point. We have a very proactive community, join our Slack and let's talk about the tech-design issue you have :)
@chudchadanstud
@chudchadanstud 8 ай бұрын
If I plan on running a db locally I usually just stil to sqlite. It's 3x faster than redis fully optimised and you can ignore the n+1 problem.
@lugalzagissi
@lugalzagissi 9 ай бұрын
Why do we need the refresh policy for the continuous aggregate if it's updated continuously?
@dreamsofcode
@dreamsofcode 9 ай бұрын
Mainly because its like a "live view" so it tracks changes in memory but needs to periodically refresh in order to commit them to the underlying materialized view. Think of it similar as git, with changes vs commits.
@lugalzagissi
@lugalzagissi 9 ай бұрын
@@dreamsofcode but will my results of querying the aggregate depend on whether or not it was refreshed recently?
@trueberryless
@trueberryless Жыл бұрын
I'm not calling you out for a dirty cheat because the video is very interesting 😉. Thank you and keep it going!
@richardbennett4365
@richardbennett4365 2 ай бұрын
Instead of Timescale, can one make use of DuckDB?
@samuelserot4158
@samuelserot4158 Жыл бұрын
Hello and thank you for your videos :) I've been interested in TimescaleDB for a while now, but my data is not completely timeseries-oriented. Each record I want to analyze can evolve over time in my current DB, so we would have mutable events if I keep my current implementation. I suppose this is not acceptable with TimescaleDB? Wouldn't it be better to transform every event that modifies one of my record in my current model into a unique event to the tsdb, with a ban on modifying the data afterwards? I hope I've made myself clear :)
@dreamsofcode
@dreamsofcode Жыл бұрын
You can use a unique index with a hypertable which will allow you to prevent duplicates, and then you can use an UPDATE to upsert any data in. It should be doable with tsdb!
@samuelserot4158
@samuelserot4158 Жыл бұрын
Thanks for your answer! I thought that too many updates could be a problem with tsdb but it probably depends on the technology, I'll have to test it :)
@othernepthar
@othernepthar 2 ай бұрын
Hey! weird question - what did you use to generate that particle effect in the background of this video?
@jshet
@jshet Жыл бұрын
What software do you use for the graphics and editing?
@dreamsofcode
@dreamsofcode Жыл бұрын
I mainly use Davinci resolve with some After effects for certain things as there's much more documentation on AE. I have a new channel coming soon which I'll talk about motion graphics using DR and AE from a coding POV.
@Fanaro
@Fanaro Жыл бұрын
Is there an equivalent but for graph (nodes and edges) data?
@spicynoodle7419
@spicynoodle7419 Жыл бұрын
Yes there are many, they are called graph databases. Neo4j is the most popular iirc
@jonatasdp
@jonatasdp Жыл бұрын
You can also use recursive queries combined with hypertables which allow you to build a kind of tree system but not graph. Probably apache age (graph extension for pg) will work well too. Never tried myself :)
@gunjitmittal3456
@gunjitmittal3456 Жыл бұрын
i really like your terminal. Can you/anyone tell/guide me how I can also achieve a similar look?
@vomiensincle
@vomiensincle Жыл бұрын
+1 same
@oscarlacueva
@oscarlacueva Жыл бұрын
The question is, why would you want to do read queries in a operational DataBase? Usually you load the data useful for analytics/ML/reporting in an analytical DB which is designed to perform read operations
@GymEnthusiastNZ
@GymEnthusiastNZ 8 ай бұрын
isn't there incremental materialised view extension for PG? surprised not mentioned... or tested..
@dreamsofcode
@dreamsofcode 8 ай бұрын
IVM is a great extension! I don't believe it's supported by any cloud providers as of yet (at least wasn't last I checked). I'll happily do a video on it though!
@guerra_dos_bichos
@guerra_dos_bichos Жыл бұрын
I have lite 200Gb of data but it's not related to time in any sense (well maybe dates), what would be the best solution there?
@dreamsofcode
@dreamsofcode Жыл бұрын
Is it possibly related to space or is there anything else that it can be partitioned on? If not then your best bet is decent indexing based on common queries. I'm going to do a video going into deeper detail on indexing at some point!
@DiogoBaeder
@DiogoBaeder Жыл бұрын
Pretty impressive indeed! Makes me want to compare that with how Apache Pinot performs. Thanks for the video!
@davidbanhos7308
@davidbanhos7308 Жыл бұрын
It is a amazing video! Congratulations! I have a question as a developer - sorry, it could be a silly question. How should be the workflow on the hyper and non-hyper tables? Will be required the code to call the hyper table version programmatically per case bases? Insert/delete/update only on the non-hyper table? Or is that a way to do it transparently?
@jonatasdp
@jonatasdp Жыл бұрын
It's totally transparent. Just insert in the hypertable and the partition works behind the scenes.
@moondevonyt
@moondevonyt Жыл бұрын
mad props for the deep dive on postgres and timescale DB it's clear you've got mad skills and dedication when it comes to this stuff i have to admit though, i don't fully buy into the idea that postgres can't handle big data efficiently without the need for something like timescale DB sure, for time series data there might be an edge, but postgres has shown some mad chops with large datasets in the right setups but, timescale DB sounds like a game changer for specific use cases keep grinding and dropping that knowledge
@peterndungu41
@peterndungu41 Жыл бұрын
I have a question is it alright to view partioning of tables to how binary search works, like you get more performance since you are not looking through the entire db
@dreamsofcode
@dreamsofcode Жыл бұрын
That is exactly how it works.
@rakeshprasad4969
@rakeshprasad4969 Жыл бұрын
first of all big fan of your content. regarding opensource, your comment on terraform? they were opensource too, till they are not. could you post some content on that?
@dreamsofcode
@dreamsofcode Жыл бұрын
That's a great point! I know some other creators have done a great job covering terraform as well. I believe Timescale would remain open source due to postgres however!
@CristianHeredia0
@CristianHeredia0 Жыл бұрын
This was great. Thanks for sharing. What do you use to make coding slides/video/transitions?
@spacenomad5484
@spacenomad5484 Жыл бұрын
12:00 Aah yes, the cloud. 5 days running cost = $170 That's the budget for an entire month of 8Core 64GB RAM dedicated server with 1TB NVMe SSD and like 10TB traffic included. bUt YoU dOn't EvEn NeEd To SeT uP tHe ClOuD Hire a pro to set up your dedicated server, schedule backups, deploy your apps, and you'll break even with the cloud offering by the end of week 2.
@ruslan_yefimov
@ruslan_yefimov Жыл бұрын
I completely agree :) Cloud is good for development stage though
@monirz001
@monirz001 Жыл бұрын
What is the theme you are using for your terminal?
@dreamsofcode
@dreamsofcode Жыл бұрын
I use Tmux and Catppuccin theme!
@monirz001
@monirz001 Жыл бұрын
@@dreamsofcode Got it thanks!
@isnimshchikov
@isnimshchikov Жыл бұрын
I feel like the pricing is a bit overboard. A similar droplet on digotalocean would cost almost 10 times less per hour. Sure, you will have to spend 30 minutes to set up a db, but then you won't be paying 900$ per month, only around 100$
@dreamsofcode
@dreamsofcode Жыл бұрын
I hear ya. I think that is the case with most managed services. I know for SOC2 compliance you'd likely need a little more than the droplet, but given that this is an open source extension, if you've got the bandwidth to self host, then that option is available. That's one thing I really like about TimescaleDB.
@tqwewe
@tqwewe Жыл бұрын
Lovely ad 👏
@xpusostomos
@xpusostomos Жыл бұрын
Actually, technically Postgres natively supports time scale data. Postgresql does not. Because the feature was in the Postgres Berkeley code but removed by the Postgresql team.
@helixx23
@helixx23 8 ай бұрын
I also want to learn more of timescale
@talideon
@talideon Жыл бұрын
Assuming they host in AWS, there's an old saying: friends don't let friends deploy to us-east-1.
@dreamsofcode
@dreamsofcode Жыл бұрын
😂
@nickcalibey6178
@nickcalibey6178 Жыл бұрын
Alright, where did you get that killer wallpaper?
@dreamsofcode
@dreamsofcode Жыл бұрын
I got it from freepik! I'd share the url but KZbin doesnt like it
@vanvothe4817
@vanvothe4817 Жыл бұрын
Do you use client gui or command line for sql?
@dreamsofcode
@dreamsofcode Жыл бұрын
I use command line for sql! psql works for me. I believe there are some decent guis that colleagues of mine use.
@vanvothe4817
@vanvothe4817 Жыл бұрын
@@dreamsofcode Sometimes I use the GUI but I usually use pgcli because it has autocompletion.
@Fanaro
@Fanaro Жыл бұрын
The world needs more of this channel.
@jajwarehouse1
@jajwarehouse1 Жыл бұрын
The averages you are getting from the materialized view are different from the trips_hyper. This is happening because you are taking the monthly averages of daily averages.
@jajwarehouse1
@jajwarehouse1 Жыл бұрын
What is more interesting now that I look at it, the averages between the standard table and the hyper table are very slightly different, as well, which is not making much sense if the data in both are identical.
@fahimferdous1641
@fahimferdous1641 Жыл бұрын
My good sir, you have definitely piqued my interest for it. I remember playing with postgres and mouse genome toy dataset on a dual core and hard disked machine. That's when I had discovered influxdb, around 8 years ago. But it was never interesting to me to play with time series data or databases. I am definitely going to try out this one. And yes, I would 10/10 love to watch a more detailed video. Also, if possible, perhaps you can make a video on Prometheus and OpenTelemetry?
@dreamsofcode
@dreamsofcode Жыл бұрын
I'm glad you enjoyed it! We've been using it at my place of work for huge time series data and it's been a joy to work with. Those are some great ideas. I shall add both to my video backlog.
@cmilkau
@cmilkau Жыл бұрын
bandaid. RDBMS should really be able to handle this case well without additional work, at most some index tweaking.
@dominikvonlavante6113
@dominikvonlavante6113 5 ай бұрын
No. Time series data is completely different to relational data. The maths and algorithms behind accessing this data is completely different.
@Zeioth
@Zeioth Жыл бұрын
I had a project where we were writing 30gb per day. A mongo cluster was the only option there.
@richardbennett4365
@richardbennett4365 Жыл бұрын
Why is the syntax of these languages written like COBOL or something equally scores old?
@coderdbd
@coderdbd 7 ай бұрын
That was one long ad.
@christopherjackson2157
@christopherjackson2157 Жыл бұрын
What about dedup tables in file servers? They can get huge and really slow and buggy. I've not yet come across a satisfactory way for dealing with them. Tho I'm by no means a db expert
@cheebadigga4092
@cheebadigga4092 Жыл бұрын
So it's basically just smart caching?
@dreamsofcode
@dreamsofcode Жыл бұрын
Yep! There's a lot of smart caching under the hood, as well as managing partitions, which enables the smart caching. It's open source (albeit written in C) so one is able to check what they're doing as well!
@weberlin5821
@weberlin5821 Жыл бұрын
Compare the P95 memory for both queries. TimescaleDB query used ~1000x morememoery
@dreamsofcode
@dreamsofcode Жыл бұрын
RAM is meant to be eaten :)
@weberlin5821
@weberlin5821 Жыл бұрын
@@dreamsofcode Indeed! 😂
@user-qr4jf4tv2x
@user-qr4jf4tv2x Жыл бұрын
would like a video on postgres streaming database
@dreamsofcode
@dreamsofcode Жыл бұрын
This is a great idea!
@miguelacuna7148
@miguelacuna7148 Жыл бұрын
when a video about your os setup? :D
@ongayijohnian8787
@ongayijohnian8787 8 ай бұрын
Mahn, please do the dadbod plugins for NvChad
@christian15213
@christian15213 Жыл бұрын
but isn't this a worlkload DB for analytics not a transactional DB. would be helpful if that was your usecase
@soufianosse333
@soufianosse333 3 ай бұрын
Yyou should've campared the hypertable with a partitionned table!
@dreamsofcode
@dreamsofcode 3 ай бұрын
There's definitely a comparison to be made! But setting up a partitioned table is much more involved than setting it up with Timescale. I have another video where I do that however!
@Petoj87
@Petoj87 Жыл бұрын
Wouldn't it be more fair if you at least had a index on the normal table?
@CielMC
@CielMC Жыл бұрын
Did you make your Linux look like MacOS or do you just have a great macos tilting WM? I'm using yabai rn but it's quite disappointing...
@CielMC
@CielMC Жыл бұрын
Also, is that tmux at the bottom?
@dreamsofcode
@dreamsofcode Жыл бұрын
It is tmux at the bottom! I have a video on my tmux configuration on my channel which goes into it! So, a lot of my windows are video editing unfortunately. I do have some utilties for screen recording and centering with xdotool, but mostly it's editing magic that makes it look like it does.
@d7584
@d7584 Жыл бұрын
i love postgres the most too
@madhavsilwal2777
@madhavsilwal2777 7 ай бұрын
Why not have timescale features as a table type or view types in normal postgres db instead of having a seperate db.
@dreamsofcode
@dreamsofcode 7 ай бұрын
Im not sure I understand fully, but timescale is PostgreSQL
@madhavsilwal2777
@madhavsilwal2777 7 ай бұрын
@@dreamsofcode May be i misunderstood then. How to enable timescale featuers in existing postgres db?
@dreamsofcode
@dreamsofcode 7 ай бұрын
@@madhavsilwal2777 It is just a postgres extension, so you can install it like you would any other. There are instructions on Github here: github.com/timescale/timescaledb
@dalicodes
@dalicodes Жыл бұрын
The github link is broken
@dreamsofcode
@dreamsofcode Жыл бұрын
Thank you for letting me know! Should be fixed now.
@fimbulvntr
@fimbulvntr Жыл бұрын
This is just a big ad. A single modern m.2 NVMe consumer drive will handle an unindexed sequential scan of 50Gb in about 10 seconds, provided it can fit in ram. Adding an index will increase the size of the table and slow down writes, but by a trivial amount. Partitioning tables and handling time series data in postgres is annoying, yes, and a solution like shown in the video may well be the answer, but the comparison is absolutely unfair and no DBA worth his/her salt would do anything like the video. Yes, I understand it's a toy example. Also AWS has a time series DB too, so if you're going to use a cloud solution you might as well use that. Which you don't need to. Just put an index. 50Gb is nowhere near any definition of big data.
@dreamsofcode
@dreamsofcode Жыл бұрын
Thanks for the comment. I appreciate hearing the feedback. I actually ran this on an m2 NVMe with 128GB of RAM (That's my home lab server). It took a little more than the 10 seconds. (3 minutes give or take). Happy to demonstrate it on my discord if you like :)
@fimbulvntr
@fimbulvntr Жыл бұрын
@@dreamsofcode Damn it, I should put my money where my mouth is, shouldn't I? You made the video and here I am rambling in the comments without putting in 10% of the effort you did. Well shit. I don't really have time to run the experiment myself. I know PG is horribly tuned for fast drives, a lot of the defaults still assume HDDs. It's even worse on windows. Also some m2 drives run out of SLC cache very fast, but 50Gb ought to fit nicely in a 980pro or SN850X. Also you could EXPLAIN ANALYZE the query, running with a WITH X AS will probably make it faster too in addition to the index. But then again you gave away your script and data and I could very well so it myself, couldn't I? Fuck me.
@dreamsofcode
@dreamsofcode Жыл бұрын
@@fimbulvntr Haha. It's fair to question the video. One should always be skeptical about sponsored content. I will say TimeScaleDB would have been happy with me using the local version (which, you're correct, is faster than 12mins), but I felt it was a better experience to use their free offering. I've got another video probably coming about indexes, as I think they're more nuanced than just throwing them in there would be, but it does mean there's some more content I get to make, so I'm not complaining :)
@dragonwave2652
@dragonwave2652 Жыл бұрын
Just wanted to write to use timescale and you said it😂
@victortesla2935
@victortesla2935 Жыл бұрын
Which linux distribution you use?
@victortesla2935
@victortesla2935 Жыл бұрын
Arch?
@mikopiko
@mikopiko Жыл бұрын
@@victortesla2935 Looks like macOS
@cheebadigga4092
@cheebadigga4092 Жыл бұрын
he's on macOS bro
@victortesla2935
@victortesla2935 Жыл бұрын
@@cheebadigga4092 no as far as I remember in the nvchad video he said he is installing it in arch
@wondays654
@wondays654 Жыл бұрын
@@cheebadigga4092it’s arch, the Mac type thing is just animation. I asked in a previous video.
@dagtveitgmail
@dagtveitgmail Жыл бұрын
Clickhouse runs circles around it if you need some more advanced and heavy querys
@kokizzu
@kokizzu Жыл бұрын
id rather use clickhouse for timeseries '__')
@dreamsofcode
@dreamsofcode Жыл бұрын
Clickhouse is pretty great. There's definitely some caveats when using it (as with all columnar stores) but if it's the right choice for you then I'm vibing.
@gjermundification
@gjermundification Жыл бұрын
How is `create_hypertable` defined? What would this be named if I was to roll my own.
@lachlanperrier2851
@lachlanperrier2851 Жыл бұрын
Ok this is a joke of some kind but.. couldn’t u just make a geometry object and rely on spatial indexing
@rossvold
@rossvold Жыл бұрын
my biggest Postgres database is 5 million company records at 8 GB, reaching 50 GB seems impossible
I've been using Redis wrong this whole time...
20:53
Dreams of Code
Рет қаралды 375 М.
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
10 things I learnt in 2024 to increase my developer productivity.
18:46
Life After SQL (EdgeDB Is Fascinating)
15:40
Theo - t3․gg
Рет қаралды 58 М.
Fundamentals of Vacuum in PostgreSQL: Module 1
12:06
Smart Postgres
Рет қаралды 1,7 М.
When RESTful architecture isn't enough...
21:02
Dreams of Code
Рет қаралды 287 М.
Tmux has forever changed the way I write code.
13:30
Dreams of Code
Рет қаралды 1 МЛН
The intro to Docker I wish I had when I started
18:27
typecraft
Рет қаралды 345 М.
Five of my favorite project ideas to learn Go.
11:31
Dreams of Code
Рет қаралды 95 М.
Database Indexing Explained (with PostgreSQL)
18:19
Hussein Nasser
Рет қаралды 323 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 1,3 МЛН