NodeCommunity
6 subscribers
84 photos
1 video
9 files
57 links
Download Telegram
NodeCommunity
https://chartio.com/learn/databases/how-does-indexing-work/ #indexing #database
Advantages

* Speed up SELECT query
* Helps to make a row unique or without duplicates(primary,unique)
* If index is set to fill-text index, then we can search against large string values. for example to find a word from a sentence etc.

Disadvantages

* Indexes take additional disk space.
* indexes slow down INSERT,UPDATE and DELETE, but will speed up UPDATE if the WHERE condition has an indexed field. INSERT, UPDATE and DELETE becomes slower because on each operation the indexes must also be updated.
#js_generators

Iterate over object values and do calculation


function * iter(obj) {
for (let [key, value] of Object.entries(obj)) {
if (Object(value) !== value) yield [obj, key, value];
else yield * iter(value);
}
}

// demo
const myObject = {
base: {
serving: {
size: 100
}
},
fat: {
acids: {
monoUnsaturatedFattyAcids: 12,
polyUnsaturatedFattyAcids: 'hello',
saturatedFattyAcids: [1, 2]
},
}
};

for (let [obj, key, value] of iter(myObject)) {
if (typeof value === "number") obj[key] *= 0.5; // multiply by 0.5
}
// The object has been mutated accordingly
console.log(myObject);
How to solve npm i error thike this on dokcer?

Here we go:

https://robinwinslow.uk/fix-docker-networking-dns

#docker #npm
Forwarded from hahacker_news
Manning.Elasticsearch.in.Action.pdf
20.3 MB
๐Ÿ“šElasticsearch in Action (2023)
โœ๏ธะะฒั‚ะพั€: Madhusudhan Konda
Forwarded from hahacker_news
Apress.Deploy.Container.Applications.Using.Kubernetes.pdf
16.1 MB
๐Ÿ“šDeploy Container Applications Using Kubernetes: With Integration and Implementations with Aws Eks and Gcp Gke (2023)
โœ๏ธะะฒั‚ะพั€: Shiva Subramanian
#postgres #docker #dump #backup

Backup postgres database running on docker.
docker exec -t <container_name_or_id> pg_dump -U <username> <db_name> > dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql


using gzip - If you want a smaller file size
docker exec -t <container_name_or_id> pg_dump -U <username> <db_name> | gzip > dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql.gz


Restore your databases
cat your_dump.sql | docker exec -i <container_name_or_id> psql -U <username> -d <db_name>