Skip to content

Instantly share code, notes, and snippets.

View Vectormike's full-sized avatar
🏠
Working from home

Victor Jonah Vectormike

🏠
Working from home
View GitHub Profile
const http = require('http');
const fs = require('fs')
const axios = require('axios')
const server = http.createServer((_, res) => {
axios.get('https://api.thecatapi.com/v1/images/search?breed_id=beng')
.then(data => console.log(data.data[0].breeds))
res.end('Hello there')
})
const http = require('http');
const fs = require('fs')
const server = http.createServer((_, res) => {
console.log(fs.readFileSync('./package.json'));
res.end('Hello there')
})
server.listen(5000)
const http = require('http');
const fs = require('fs')
const server = http.createServer((_, res) => {
fs.readFile('./package.json', console.log)
res.end('Hello there')
})
server.listen(5000)
const http = require('http');
const server = http.createServer((_, res) => res.end('Hello there'));
server.listen(5000);
console.log('Server running');
const OS = require('os')
process.env.UV_THREADPOOL_SIZE = OS.cpus().length
indexing=# explain analyze select name from students where name = 'Victor';
QUERY PLAN
---------------------------------------------------------------------------------------------------
Seq Scan on students (cost=0.00..1.30 rows=1 width=32) (actual time=0.010..0.011 rows=2 loops=1)
Filter: (name = 'Victor'::text)
Rows Removed by Filter: 22
Planning Time: 0.040 ms
Execution Time: 0.019 ms
(5 rows)
indexing=# create index student_name on students(name);
CREATE INDEX
indexing=# explain analyze select name from students where name = 'Victor';
QUERY PLAN
----------------------------------------------------------------------------------------------------
Seq Scan on students (cost=0.00..20.12 rows=4 width=32) (actual time=1.677..1.715 rows=2 loops=1)
Filter: (name = 'Victor'::text)
Rows Removed by Filter: 22
Planning Time: 15.170 ms
Execution Time: 10.083 ms
(5 rows)
indexing=# explain analyze select name from students where id = 20;
QUERY PLAN
----------------------------------------------------------------------------------------------------
Seq Scan on students (cost=0.00..20.12 rows=4 width=32) (actual time=0.068..0.070 rows=1 loops=1)
Filter: (id = 20)
Rows Removed by Filter: 23
Planning Time: 0.209 ms
Execution Time: 0.151 ms
(5 rows)
indexing=# explain analyze select id from students where id = 20;
QUERY PLAN
---------------------------------------------------------------------------------------------------
Seq Scan on students (cost=0.00..20.12 rows=4 width=8) (actual time=0.009..0.010 rows=1 loops=1)
Filter: (id = 20)
Rows Removed by Filter: 23
Planning Time: 0.033 ms
Execution Time: 0.020 ms
(5 rows)