3 ms·
As soon as you need to do a JOIN, you're either rewriting a database or replatforming on Sqlite.
by noveltyaccount 6mo ago
As soon as you need to do a JOIN, you're either rewriting a database or replatforming on Sqlite.
- pgtan 6mo agoHere are two checks using joins, one with sqlite, one with the join builtin of ksh93: check_empty_vhosts () { # Check which vhost adapter doesn't have any VTD mapped start_sqlite tosql "SELECT l.vios_name,l.vadapter_name FROM vios_vadapter AS l LEFT OUTER JOIN vios_wwn_disk_vadapter_vtd AS r USING (vadapter_name,vios_name) WHERE r.vadapter_name IS NULL AND r.vios_name IS NULL AND l.vadapter_name LIKE 'vhost%';" endsql getsql stop_sqlite } check_empty_vhosts_sh () { # same as above, but on the shell join -v 1 -t , -1 1 -2 1 \ <(while IFS=, read vio host slot; do if [[ $host == vhost* ]]; then print ${vio}_$host,$slot fi done < $VIO_ADAPTER_SLOT | sort -t , -k 1)\ <(while IFS=, read vio vhost vtd disk; do if [[ $vhost == vhost* ]]; then print ${vio}_$vhost fi done < $VIO_VHOST_VTD_DISK | sort -t , -k 1) }
- goerch 6mo agoa) Just heard today: JOINs are bad for performance b) How many columns can (an Excel) table have: no need for JOINs
- datadrivenangel 6mo agovlookups are bad for performance. recursive vlookups even more so.
- hunterpayne 6mo agoWow, I'm sorry you have to work with such coworkers. For reference, joins are just an expensive use case. DBs do them about 10x faster that you can do them by hand. But if you need a join, you probably should either a) do it periodically and cache the result (making your data inconsistent) or b) just do it in a DB. Confusing caching the result with doing the join efficiently is an amazing misunderstanding of basic Computer Science.