Creating a 100 gigabyte index on 1 billion+ rows

  Рет қаралды 5,305

PlanetScale

PlanetScale

Күн бұрын

Пікірлер: 33
@efeegbevwie9467
@efeegbevwie9467 7 ай бұрын
While these indexes are being created, does the database lock the tables? Will this make your application unresponsive if the tables cannot be accessed?
@PlanetScale
@PlanetScale 7 ай бұрын
You can still do DML (for example, inserting something into the table) for the btree indexes. However, this is not permitted when creating the fulltext! More info in the docs: dev.mysql.com/doc/refman/8.0/en/innodb-online-ddl-operations.html#online-ddl-index-syntax-notes
@ArthurHenriqueta
@ArthurHenriqueta 7 ай бұрын
@@PlanetScale what is the solution on this case?
@TalhaMajeed-e6j
@TalhaMajeed-e6j 7 ай бұрын
I already have PK, which is string, can I make another column as FTS_DOC_ID field ?
@PlanetScale
@PlanetScale 7 ай бұрын
You could add it! However, if you try to build a FULLTEXT index on a table without it, it will automatically rebuild the table to incorporate that index so you don't have to handle it manually. Just makes the index creation take longer.
@userasd360
@userasd360 7 ай бұрын
how did you manage the uptime for the server in case of the index whichtook 7 hours?
@PlanetScale
@PlanetScale 7 ай бұрын
This would definitely be a consideration if this was in production! For the purpose of the video, this was for testing the app pre-release. You specify the fulltext index at the time of table creation, and have it build incrementally as new messages arrive. However, this will add some overhead for table insertions.
@PlanetScale
@PlanetScale 7 ай бұрын
This would also be a great use case for PlanetScale branching + deploy requests.
@rickdg
@rickdg 7 ай бұрын
The real test is doing queries while the table is getting written into.
@devperatetechno8151
@devperatetechno8151 7 ай бұрын
wow, amazing
@DavidYoo-m7z
@DavidYoo-m7z 7 ай бұрын
Yeah this is awesome
@Kaldrax
@Kaldrax 7 ай бұрын
Sounds like a usecase outside of bioinformatics for interleaved bloom filters. The end result looks still pretty slow to me.
@mrmehdigh9622
@mrmehdigh9622 7 ай бұрын
Does the full text index work for all languages? for example a language like Arabic?
@PlanetScale
@PlanetScale 7 ай бұрын
Great question! In the video we're using a utf8mb4 character set, but MySQL supports a large number of other character sets as well: dev.mysql.com/doc/mysql-g11n-excerpt/8.3/en/charset-charsets.html Give it a try with a different one! FULLTEXT indexes work on char, varchar, and text column types.
@mrmehdigh9622
@mrmehdigh9622 7 ай бұрын
@@PlanetScale Thanks, So with select a good charset we can use full text index on the text column? Does the tokenization process work for a RTL (ex: Arabic or Persian) Language?
@SebastianMares
@SebastianMares 7 ай бұрын
Oh, and apropos full-text index. Wondering why after updating MySQL 5.7 to 8.0 queries that took < 1s to execute are now taking 6 seconds. Similar setup to yours where the FTI is over one column and the query only checks that column. 700k rows. Not sure if I should simply rebuild the index.
@PlanetScale
@PlanetScale 7 ай бұрын
Hard to say without more info about the query and DB. Have you confirmed that after migrating/upgrading the index still exists? What does "SHOW INDEXES FROM table_name;" say?
@otmanm4095
@otmanm4095 7 ай бұрын
Greta video! Thx sharing
@SebastianMares
@SebastianMares 7 ай бұрын
How many rooms are there in the test data? Asking because I always thought an index makes sense if the cardinality is high (= there is a lot of variance in the data). I would be surprised to see such a big impact on speed if there were only a handful of rooms.
@PlanetScale
@PlanetScale 7 ай бұрын
This this setup, the population script for the DB put 1000 messages in per room, meaning there were over a million different room names.
@saurabh9446
@saurabh9446 7 ай бұрын
So, next step would be to store that in elastic search?
@SanderCokart
@SanderCokart 7 ай бұрын
So what would be the next step to make it even faster?
@PlanetScale
@PlanetScale 7 ай бұрын
We have a part 2 coming out soon where we cover just that
@amrishshah8982
@amrishshah8982 7 ай бұрын
What storage engine is required for full text? Does it work on innodb?
@AndersGustafsson87
@AndersGustafsson87 7 ай бұрын
yes.
@PlanetScale
@PlanetScale 7 ай бұрын
Yep, this table was using innodb in the video!
@ericowens3023
@ericowens3023 7 ай бұрын
Great Vid
@ayder
@ayder 7 ай бұрын
Btree indexes never worked in any database if you query field like ‘%search_keyword% instead ‘search_keyword%’ only works. Creating a fulltext index on populated table is painful, instead create an empty table with full text index and populate data. ( insert into select … ) . Last with that many records you have to shard the db or use some partitioning to manage data
@finlanderxx
@finlanderxx 7 ай бұрын
Populating the rows and indexes at the same time sounds as painful as doing them separately.
I loaded 100,000,000 rows into MySQL (fast)
18:27
PlanetScale
Рет қаралды 179 М.
Faster than a regular database index
13:39
PlanetScale
Рет қаралды 20 М.
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 11 МЛН
Don't hide your database indexes!
11:35
PlanetScale
Рет қаралды 12 М.
`const` was a mistake
31:50
Theo - t3․gg
Рет қаралды 138 М.
Working with time series data in MySQL
20:35
PlanetScale
Рет қаралды 21 М.
I Suck At SQL, Now My DB Tells Me How To Fix It
15:40
Theo - t3․gg
Рет қаралды 52 М.
Many to many relationships in MySQL
15:42
PlanetScale
Рет қаралды 31 М.
Easy database indexing strategies
36:03
PlanetScale
Рет қаралды 25 М.
RAND is too slow (in MySQL)
17:32
PlanetScale
Рет қаралды 13 М.
SQLite For Beginners: Indexes, beyond the basics
9:32
Mycelial
Рет қаралды 9 М.
Pagination in MySQL - offset vs. cursor
13:20
PlanetScale
Рет қаралды 59 М.
Coding a Web Server in 25 Lines - Computerphile
17:49
Computerphile
Рет қаралды 342 М.