SQLite mySQL MSSQL Postgres - sgml/signature GitHub Wiki
- https://docs.data.world/documentation/sql/concepts/advanced/WITH.html%20
- https://topanswers.xyz/databases
- https://www.postgresql.org/docs/current/fuzzystrmatch.html
- https://www.sqlite.org/afl/doc/trunk/README.md
- https://www.postgresql.org/docs/release/14.0/
- https://www.postgresql.org/docs/release/15.0/
- https://www.postgresql.org/docs/release/16.0/
- https://wiki.postgresql.org/wiki/Extensions
- https://wiki.postgresql.org/wiki/Building_and_Installing_PostgreSQL_Extension_Modules
- https://www.postgresql.org/docs/current/extend-pgxs.html
- https://www.slingacademy.com/article/ways-to-fix-postgresql-invalid-datetime-format-error/
- https://www.2ndquadrant.com/en/blog/postgresql-anti-patterns-unnecessary-jsonhstore-dynamic-columns/
- https://stackoverflow.com/questions/38142623/how-to-convert-a-xml-into-jsonb-within-postgres
- https://news.ycombinator.com/item?id=12408634
- https://community.cloudera.com/t5/Support-Questions/How-to-put-Json-data-as-a-Json-format-in-HBase/td-p/196339
- https://www.citusdata.com/blog/2016/07/14/choosing-nosql-hstore-json-jsonb/
- https://aws.amazon.com/blogs/database/determining-the-optimal-value-for-shared_buffers-using-the-pg_buffercache-extension-in-postgresql/
- https://www.postgresql.org/docs/current/wal-reliability.html
- https://wiki.postgresql.org/wiki/Operations_cheat_sheet
- https://www.postgresql.org/docs/current/pgcrypto.html
- https://aws.amazon.com/blogs/database/scram-authentication-in-rds-for-postgresql-13/
- https://www.percona.com/blog/postgresql-14-and-recent-scram-authentication-changes-should-i-migrate-to-scram/
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html
- https://docs.digitalocean.com/products/databases/postgresql/how-to/migrate/
- https://www.pgadmin.org/docs/pgadmin4/development/psql_tool.html
- https://www.manniwood.com/2005_01_01/best_way_to_execute_sql_scripts_using_psql.html
- https://www.postgresql.org/docs/current/backup-dump.html
- https://www.postgresql.org/docs/current/app-psql.html
- https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-connecting-psql
- https://severalnines.com/blog/backup-postgresql-using-pgdump-and-pgdumpall/
- https://gist.github.com/valferon/4d6ebfa8a7f3d4e84085183609d10f14?permalink_comment_id=3939020
- https://www.postgresqltutorial.com/postgresql-administration/postgresql-backup-database/
- https://severalnines.com/blog/backup-postgresql-using-pgdump-and-pgdumpall/
- https://linux.die.net/man/1/pg_dump
- https://www.postgresql.org/docs/current/app-pgrestore.html
- https://guillaume-martin.github.io/postgresql-backup.html
- https://simplebackups.com/blog/postgresql-pgdump-and-pgrestore-guide-examples/
- https://mr-khan.gitlab.io/postgresql/2018/05/02/database-backup-restore-postgresql.html
- https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
- https://docs.digitalocean.com/products/databases/postgresql/how-to/migrate/
- https://wiki.postgresql.org/images/5/59/FlexiblePostgreSQLConfiguration.pdf
- https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
- https://hasura.io/blog/building-a-ui-for-postgresql-database-migrations/
- https://spin.atomicobject.com/2019/03/26/postgresql-database-client/
# UUID4 RegExp: wrap with paren on the outside to deferences the first index. Indices start at one (REGEXP_MATCH(foo, '[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}'))[1]
import os
# Define the table name to be copied and the source/target databases
table_name = 'your_table_name'
source_db = 'foo'
target_db = 'bar'
# Define the SQL commands
sql_commands = f"""
\\c {source_db}
COPY {table_name} TO STDOUT WITH CSV HEADER;
\\c {target_db}
COPY {table_name} FROM STDIN WITH CSV HEADER;
"""
# Write the SQL commands to a file
with open('pgplsql.sql', 'w') as file:
file.write(sql_commands)
# Execute the SQL file as a separate process
os.system('psql -f pgplsql.sql')
steps:
- step: Create a Partitioned Table
details: >
First, create a partitioned table that will be split by month.
You can use **range partitioning** based on a date column.
code: |
CREATE TABLE sales (
id SERIAL PRIMARY KEY,
sale_date DATE NOT NULL,
amount NUMERIC(10, 2) NOT NULL
) PARTITION BY RANGE (sale_date);
- step: Create Partitions for Each Month
details: >
Next, create partitions for each month. You can automate this process using a function.
code: |
CREATE OR REPLACE FUNCTION create_monthly_partitions() RETURNS VOID AS $$
DECLARE
month_start DATE;
month_end DATE;
BEGIN
month_start := DATE_TRUNC('month', CURRENT_DATE);
month_end := month_start + INTERVAL '1 MONTH' - INTERVAL '1 DAY';
EXECUTE 'CREATE TABLE sales_' || TO_CHAR(month_start, 'YYYY_MM') || ' PARTITION OF sales FOR VALUES FROM (''' || month_start || ''') TO (''' || month_end || ''')';
END;
$$ LANGUAGE plpgsql;
- step: Schedule the Function to Run Monthly
details: >
You can use a **cron job** or a **scheduler** like pg_cron to run this function at the start of each month.
- step: Create a New Database at the Start of Each Month
details: >
To create a new database at the start of each month, you can use a similar approach with a function and a trigger.
code: |
CREATE OR REPLACE FUNCTION create_new_database() RETURNS VOID AS $$
BEGIN
EXECUTE 'CREATE DATABASE db_' || TO_CHAR(CURRENT_DATE, 'YYYY_MM');
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION create_database_trigger() RETURNS TRIGGER AS $$
BEGIN
IF (NEW.sale_date IS NOT NULL) THEN
PERFORM create_new_database();
END IF;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER create_database_trigger
AFTER INSERT ON sales
FOR EACH ROW EXECUTE FUNCTION create_database_trigger();
- step: Schedule the Trigger Function
details: >
You can also schedule the trigger function to run at the start of each month using a scheduler.
- summary: >
By following these steps, you can automate the process of splitting your table into monthly partitions and creating a new database at the start of each month. This approach ensures that your data is organized efficiently and that new databases are created regularly.
- https://www.oreilly.com/library/view/sql-in-a/9780596155322/ch04s01s01.html
- https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
- https://cs.ulb.ac.be/public/_media/teaching/infoh415/tempfeaturessql2011.pdf
- https://www.oracle.com/technetwork/database/database-technologies/rdb/0307-sql1999-130211.pdf
- https://crate.io/docs/sql-99/en/latest/chapters/01.html
- https://stackoverflow.com/questions/1599050/will-ansi-join-vs-non-ansi-join-queries-perform-differently
- https://www.databasejournal.com/features/mysql/querying-multiple-mysql-tables.html
- https://dba.stackexchange.com/questions/212200/how-do-i-do-a-join-in-ansi-sql-89-syntax
- https://en.wikibooks.org/wiki/SQL_Dialects_Reference/Print_version
- https://dveeden.github.io/modern-sql-in-mysql/
- http://metadata-standards.org/Document-library/Documents-by-number/WG2-N1501-N1550/WG2_N1536_koa046-Temporal-features-in-SQL-standard.pdf
- http://www.redbooks.ibm.com/redbooks/pdfs/sg247847.pdf
- https://archive.org/stream/DiscoveringSQLAHandsOnGuideForBeginners/Kriegel_Alex_-_Discovering_SQL_A_Hands-On_Guide_for_Beginners_djvu.txt
- https://www.codeproject.com/articles/621532/comparison-of-triggers-in-ms-sql-and-oracle
- https://stackoverflow.com/questions/10167346/row-level-trigger-vs-statement-level-trigger
The return value of a row-level trigger fired AFTER or a statement-level trigger fired BEFORE or AFTER is always ignored; it might as well be null. However, any of these types of triggers might still abort the entire operation by raising an error.
This example trigger ensures that any time a row is inserted or updated in the table, the current user name and time are stamped into the row. And it checks that an employee's name is given and that the salary is a positive value. CREATE TABLE emp ( empname text, salary integer, last_date timestamp, last_user text ); CREATE FUNCTION emp_stamp() RETURNS trigger AS $emp_stamp$ BEGIN -- Check that empname and salary are given IF NEW.empname IS NULL THEN RAISE EXCEPTION 'empname cannot be null'; END IF; IF NEW.salary IS NULL THEN RAISE EXCEPTION '% cannot have null salary', NEW.empname; END IF; -- Who works for us when they must pay for it? IF NEW.salary < 0 THEN RAISE EXCEPTION '% cannot have a negative salary', NEW.empname; END IF; -- Remember who changed the payroll when NEW.last_date := current_timestamp; NEW.last_user := current_user; RETURN NEW; END; $emp_stamp$ LANGUAGE plpgsql; CREATE TRIGGER emp_stamp BEFORE INSERT OR UPDATE ON emp FOR EACH ROW EXECUTE FUNCTION emp_stamp();
Statement-level BEFORE triggers naturally fire before the statement starts to do anything, while statement-level AFTER triggers fire at the very end of the statement. These types of triggers may be defined on tables, views, or foreign tables. Row-level BEFORE triggers fire immediately before a particular row is operated on, while row-level AFTER triggers fire at the end of the statement (but before any statement-level AFTER triggers). These types of triggers may only be defined on tables and foreign tables, not views. INSTEAD OF triggers may only be defined on views, and only at row level; they fire immediately as each row in the view is identified as needing to be operated on.
The execution of an AFTER trigger can be deferred to the end of the transaction, rather than the end of the statement, if it was defined as a constraint trigger. In all cases, a trigger is executed as part of the same transaction as the statement that triggered it, so if either the statement or the trigger causes an error, the effects of both will be rolled back.
- sqlalchemy limit import offset site:gist.github.com
- https://github.com/sqlalchemy/sqlalchemy/wiki/UsageRecipes
- https://github.com/sqlalchemy/sqlalchemy/wiki/Views
- https://docs.sqlalchemy.org/en/13/orm/tutorial.html#common-filter-operators
- https://docs.sqlalchemy.org/en/13/glossary.html
- https://stackoverflow.com/questions/8603088/sqlalchemy-in-clause
- https://stackoverflow.com/questions/29974143/python-sqlalchemy-and-postgres-how-to-query-a-json-element/29975187
- https://kite.com/python/docs/sqlalchemy.engine.ResultProxy.fetchone
- https://hackersandslackers.com/sqlalchemy-data-models/
- https://docs.sqlalchemy.org/en/13/core/connections.html?highlight=dispose#sqlalchemy.engine.Engine.dispose
- https://docs.sqlalchemy.org/en/13/core/events.html?highlight=dispose#sqlalchemy.events.ConnectionEvents.engine_disposed
- https://lucumr.pocoo.org/2011/7/19/sqlachemy-and-you/
- https://overiq.com/sqlalchemy-101/crud-using-sqlalchemy-orm/
- https://stackoverflow.com/questions/43128475/generate-schema-sql-with-sqlalchemy
- https://docs.sqlalchemy.org/en/13/orm/examples.html#extending-the-orm
- https://capnfabs.net/posts/sqlalchemy-connection-management/
- https://docs.sqlalchemy.org/en/13/orm/persistence_techniques.html
- https://dev.to/zchtodd/sqlalchemy-performance-anti-patterns-and-their-fixes-4bmm
- https://stackoverflow.com/questions/15750557/sqlalchemy-why-create-a-sessionmaker-before-assign-it-to-a-session-object
- https://github.com/ChrisCummins/format/blob/master/labm8/py/sqlutil.py
- https://github.com/Luidiblu/stock-api/blob/master/stock_api/database/__init__.py
- https://github.com/ppaskowsky/linuxtorrents/blob/master/main.py
- https://github.com/crazyguitar/pysheeet/blob/master/docs/notes/python-sqlalchemy.rst
- https://www.compose.com/articles/using-postgresql-through-sqlalchemy/
- https://www.tutorialspoint.com/sqlalchemy/sqlalchemy_dialects.htm
- https://docs.sqlalchemy.org/en/13/errors.html
- https://docs.sqlalchemy.org/en/13/orm/session_state_management.html
- https://www.pythoncentral.io/understanding-python-sqlalchemy-session/
- http://newcoder.io/scrape/part-3/
- https://overiq.com/sqlalchemy-101/installing-sqlalchemy-and-connecting-to-database/
- https://blog.theodo.com/2017/03/developping-a-flask-web-app-with-a-postresql-database-making-all-the-possible-errors/
- https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/
- https://www.tutorialspoint.com/sqlalchemy/sqlalchemy_dialects.htm
- https://github.com/citusdata/pg_cron
- https://github.com/search?q=%22func.jsonb_set%22&type=code
- https://www.crunchydata.com/blog/postgresl-unlogged-tables
- https://wiki.postgresql.org/wiki/PostgreSQL_derived_databases
- https://www.postgresql.org/docs/current/information-schema.html
- https://www.postgresql.org/docs/9.1/sql-update.html
- https://www.postgresql.org/docs/12/server-start.html
- https://www.postgresql.org/about/news/postgresql-14-released-2318/
- https://www.postgresql.org/docs/current/auth-password.html
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.Roles.html
- https://www.postgresonline.com/journal/archives/223-Sweat-the-small-stuff,-it-really-matters.html
- https://github.com/dbcli/pgcli/blob/master/tests/test_sqlcompletion.py
- https://rietta.com/blog/postgresql-currency-types/
- https://severalnines.com/database-blog/understanding-check-constraints-postgresql
- https://github.com/dbcli/pgcli/blob/master/changelog.rst
- https://lerner.co.il/2014/05/22/looking-postgresql-arrays/
- https://stackoverflow.com/questions/28405654/how-to-get-last-24-hrs-data-in-postgresql
- https://www.pgcli.com/commands
- https://x-team.com/blog/automatic-timestamps-with-postgresql/
- https://www.postgresql.org/docs/9.2/plpgsql-trigger.html
- https://postgis.net/workshops/postgis-intro/history_tracking.html
- https://www.postgresql.org/docs/current/libpq-envars.html
- https://tomcam.github.io/postgres/
- https://www.postgresql.org/docs/9.4/functions-json.html
- https://en.wikibooks.org/wiki/PostgreSQL/ClientServerComm_Client
- https://jip.dev/notes/postgresql/
- https://www.slideshare.net/AlexanderKorotkov/oh-that-ubiquitous-json
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html
- https://wiki.postgresql.org/wiki/PostgreSQL_Clients#JackDB
- https://wiki.postgresql.org/wiki/Don%27t_Do_This
- https://docs.aws.amazon.com/AmazonRDS/latest/PostgreSQLReleaseNotes/postgresql-versions.html
- https://www.postgresql.org/download/products/6-postgresql-extensions/
import subprocess
import sys
def run_psql_profiler(pgbouncer_instance):
command = [
'psql',
'-h', pgbouncer_instance['host'],
'-p', str(pgbouncer_instance['port']),
'-U', pgbouncer_instance['user'],
'-d', 'pgbouncer',
'-c', 'SHOW POOLS;'
]
result = subprocess.run(command, capture_output=True, text=True, env={"PGPASSWORD": pgbouncer_instance['password']})
if result.returncode == 0:
print("PSQL Profiler Output:")
print(result.stdout)
else:
print("Error running PSQL Profiler:")
print(result.stderr)
if __name__ == "__main__":
if len(sys.argv) != 5:
print("Usage: python script.py <host> <port> <user> <password>")
sys.exit(1)
pgbouncer_instance = {
'host': sys.argv[1],
'port': int(sys.argv[2]),
'user': sys.argv[3],
'password': sys.argv[4]
}
run_psql_profiler(pgbouncer_instance)
- https://docs.vmware.com/en/VMware-Greenplum/5/greenplum-database/utility_guide-admin_utilities-pgbouncer-admin.html
- https://pypi.org/project/pgbouncer/
- http://www.pgbouncer.org/changelog.html
- https://nvd.nist.gov/vuln/detail/CVE-2021-3935
import psycopg2
# Define the connection parameters
pgbouncer_host = 'localhost'
pgbouncer_port = 6432
pgbouncer_user = 'pgbouncer'
pgbouncer_password = 'your_password'
# Connect to PgBouncer
conn = psycopg2.connect(
host=pgbouncer_host,
port=pgbouncer_port,
user=pgbouncer_user,
password=pgbouncer_password,
dbname='pgbouncer'
)
# Create a cursor object
cur = conn.cursor()
# Query the runtime settings
cur.execute("SHOW PGBouncerSettings;")
settings = cur.fetchall()
# Print the settings
for setting in settings:
print(setting)
# Close the cursor and connection
cur.close()
conn.close()
- https://www.postgresql.org/docs/11/release-11.html
- https://www.postgresql.org/docs/11/functions-textsearch.html
- https://compose.com/articles/faster-operations-with-the-jsonb-data-type-in-postgresql/
- https://stackoverflow.com/questions/41922828/filtering-on-postgresql-jsonb-column-doesnt-work
## Aliases Output aliases cannot be used in the WHERE part. You have two choices: subquery or duplicate the definition. ``` select jsonb_array_elements((ARRAY(select jsonb_array_elements(msg->'root') ele ))[2]::jsonb) filterin from js where jsonb_array_elements((ARRAY(select jsonb_array_elements(msg->'root') ele ))[2]::jsonb)->>'cid'='CID1'; ``` or ``` SELECT filterin FROM (select jsonb_array_elements((ARRAY(select jsonb_array_elements(msg->'root') ele ))[2]::jsonb) filterin from js) data WHERE filterin->>'cid'='CID1'; ```
JSONB columns used to store metadata can be malformed JSON. Use regexp replacements to parse it. For example, this parses any value that begins with a capital letter, such as "'Foo'"
which regexp_match returns as "{'Foo'}"
select uuid, id, (regexp_replace( regexp_match(meta::text, '\u0027[A-Z][^\u0027]+.')::text, '[^A-Za-z\s]+', '','g' ) ) as name from accounts where uuid = 'fdfdfa-3r3434-sdfaf-334343'
- https://www.pmwiki.org/wiki/Cookbook/SQLite
- https://stackoverflow.com/questions/54229962/how-to-programmatically-convert-multiple-db-files-to-csv-in-python-or-r/54230111
- https://quality.mozilla.org/2013/04/volume-testing-the-import-feature-of-the-firefox-os-contacts-app/
- https://www.twosixlabs.com/sqlite-as-a-shell-script/
- https://aws.amazon.com/blogs/aws/another_databas/
- https://kailaspatil.blogspot.com/2013/07/python-script-to-convert-json-file-into.html
- https://www.phparch.com/2011/11/full-text-search-with-sqlite/
- https://www.tutorialspoint.com/sqlite/sqlite_perl.htm
- http://adamantine.me/2017/05/22/how-to-write-data-to-a-sqlite-database-in-python/
- http://xmodulo.com/access-sqlite-database-perl.html
- https://www.slideshare.net/ldami/sq-lite-virtualtables
- http://adamantine.me/2017/05/22/how-to-write-data-to-a-sqlite-database-in-python/
- https://androidjson.com/save-store-php-mysql-json-parsing-data-sqlite/
- https://coderwall.com/p/byoycg/export-all-tables-in-a-sqlite3-db-to-csv-files
- http://www.seanbehan.com/how-to-import-csv-into-sqlite3/
- https://www.sqlite.org/cvstrac/wiki?p=ImportingFiles
- https://www.sqlitetutorial.net/
- http://proc-x.com/2014/08/translate-sass-sas7bdat-format-to-sqlite-and-pandas/
- https://simply-python.com/2015/03/04/storing-and-retrieving-stock-data-from-sqlite-database/
- https://www.reddit.com/r/Python/comments/6y1ud9/writing_a_sqlite_clone_from_scratch_in_c/
- https://medium.com/@williamkoehrsen/data-wrangling-with-python-and-sqlite-900d21bc5a53
- http://charlesleifer.com/blog/five-reasons-you-should-use-sqlite-in-2016/
- http://www.evanjones.ca/sqlite-for-data-analysis.html
- https://plot.ly/python/big-data-analytics-with-pandas-and-sqlite/
- https://pythonspot.com/sqlite-database-with-pandas/
- https://www.sqlite.org/oldnews.html
- https://www.quackit.com/sqlite/tutorial/backup_a_database_to_file.cfm
- http://eprints.whiterose.ac.uk/132551/8/p29_block.pdf
- https://www.oracle.com/technetwork/topics/php/highperf-php-preso-405765.pdf
- https://news.ycombinator.com/item?id=15648280
- https://www.hwaci.com/sw/sqlite/cerod.html
- https://changelog.com/podcast/201
- http://my-symbian.com/main/index.php?m=200804
- https://blog.lizardwrangler.com/2008/02/27/the-sqlite-consortium/
- https://sqlite.org/prosupport.html
- https://jugad2.blogspot.com/2014/03/database-to-json-in-python.html
- https://www.ibm.com/developerworks/library/ws-simplelogin/
- http://blogs.perl.org/users/joel_berger/2014/09/mojolicious-do-it-for-the-candy.html
- http://www.ruddwire.com/1049/tech/perl-script-make-mysql-query-binds-variables-outputs-json/
- https://www.domoticz.com/wiki/Perl_for_Domoticz
- https://fedora-java.github.io/howto/latest/
- http://www.pererikstrandberg.se/blog/index.cgi?page=DataAnalysisWithPython
- https://www.fullstackpython.com/sqlite.html
- https://news.ycombinator.com/item?id=15605669
- https://www.percona.com/blog/2013/01/16/sphinx-search-performance-optimization-multi-threaded-search/
- https://learn.microsoft.com/en-us/sql/relational-databases/user-defined-functions/deterministic-and-nondeterministic-functions
- https://www.sqlskills.com/blogs/erin/sql-server-maintenance-plans-and-parallelism-index-rebuild/
- https://sqlperformance.com/2013/08/t-sql-queries/parallel-select-into
- https://www.red-gate.com/simple-talk/sql/learn-sql-server/understanding-and-using-parallelism-in-sql-server/
- https://www.red-gate.com/simple-talk/sql/t-sql-programming/creating-cross-tab-queries-and-pivot-tables-in-sql/
- https://severalnines.com/blog/migrating-mssql-postgresql-what-you-should-know
- https://www.convert-in.com/mysql-to-postgres-types-mapping.htm
- https://www.periscopedata.com/blog/how-to-format-numbers-as-currency-in-postgres-mysql-and-redshift
- https://opensolitude.com/2013/12/26/postgresql-json.html
- https://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_9.2
- https://www.tutorialspoint.com/postgresql/postgresql_triggers.htm
- https://www.enterprisedb.com/postgres-tutorials/everything-you-need-know-about-postgresql-triggers
- https://www.sqltutorial.org/sql-triggers/
- https://www.postgresqltutorial.com/creating-first-trigger-postgresql/
- https://dba.stackexchange.com/questions/95415/how-to-delete-all-rows-with-empty-field-via-function-trigger-combo-in-postgres-v
- https://stackoverflow.com/questions/11001118/postgres-trigger-after-insert-accessing-new
- https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
- http://media.datadirect.com/download/docs/ddxquery/allddxq/reference/wwhelp/wwhimpl/common/html/wwhelp.htm?context=reference&file=database_support3.html
- https://www.xaprb.com/blog/2006/08/13/four-types-of-database-abstraction-layers/
- http://www.postgresonline.com/journal/archives/21-SQL-Math-Idiosyncracies.html
- https://www.mediawiki.org/wiki/Manual:Database_access
- https://www.sqlite.org/sqllogictest/wiki?name=Differences+Between+Engines
- https://www.oreilly.com/library/view/high-performance-mysql/9781449332471/ch04.html
- https://hackernoon.com/are-implicit-conversions-killing-your-sql-query-performance-70961e547f11
- https://prestosql.io/blog/2019/05/21/optimizing-the-casts-away.html
- https://www.sqlshack.com/implement-graph-database-sql-server-2017/
- https://news.ycombinator.com/item?id=25544397
https://kb.promise.com/thread/what-s-the-difference-between-asynchronous-and-synchronous-mirrors/ https://library.netapp.com/ecmdocs/ECMP12404965/html/GUID-B513B031-D524-4E0D-8FB1-3984C9D9FA20.html https://www.brianstorti.com/replication/ http://www.cattell.net/datastores/Datastores.pdf http://www.cs.sjsu.edu/faculty/kim/nosql/contents/presentation/slides/ScalableSQLandNoSQLDataStores.pdf
- https://blog.thedataincubator.com/2018/05/sqlite-vs-pandas-performance-benchmarks/
- https://qoppac.blogspot.com/2014/10/using-sqllite3-to-store-static-and-time.html
- https://www.sqlite.org/serverless.html
- https://blog.zappa.io/posts/s3sqlite-a-serverless-relational-database
- https://www.postgresql.org/docs/current/xml2.html
- https://www.postgresql.org/docs/current/docguide-toolsets.html
- https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/XML-Data-Type/XML-Operations/XML-Type-Usage-Examples/Example-XQuery-Query
- https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p1239s1xykyixpn1hlvlkvlhvl9e.htm
- https://www.postgresql.org/docs/17/wal-intro.html
- https://partnerintelligence.teradata.com/Partner-Intelligence-Assets/General%20Resources/071024%20Critical%20Success%20Factors%20Deploying%20Pervasive%20BI%20EB5408-%20FINAL_3252010132115.pdf
select (regexp_replace(regexp_replace('2021-5-9', '(-)([0-9]$)', '\10\2', 'g'), '(-)([0-9]-)', '\10\2', 'g'))
+----------------+ +-----------------+ +-----------------+ | | | | | | | Transaction | | Write-Ahead | | Database Disk | | (Begin) | --> | Log | --> | Storage | | | | | | | +----------------+ +-----------------+ +-----------------+ | | | | | | +----------------+ +-----------------+ +-----------------+ | | | | | | | Transaction | | Write-Ahead | | Database Disk | | (Commit) | --> | Log | --> | Storage | | | | | | | +----------------+ +-----------------+ +-----------------+
Process:
- A transaction is first recorded in memory
- Any CRUD mutations are written to the Write-Ahead Log (WAL) from memory next
- Finally, the transaction is committed to the database storage, and the changes are flushed from the WAL
If a crash occurs, all committed transactions can be replayed from the WAL to bring the database back to a consistent state
,Teradata,Oracle Use Case,"Large-scale data warehousing and analytics","Wide range of applications including transaction processing, data warehousing, and enterprise applications" Architecture,"Massively Parallel Processing (MPP)","Shared-nothing"
Feature,PostgreSQL,Oracle,Teradata,MySQL WAL Purpose,"Ensures data integrity and durability","Provides atomicity and durability","Ensures data consistency and recovery","Ensures data durability and recovery" WAL Mechanism,"Records changes before applying them","Logs changes before applying them","Uses a combination of logging and checkpointing","Logs changes before applying them" Checkpointing,"Periodic checkpoints to flush WAL to disk","Periodic checkpoints to flush WAL to disk","Frequent checkpoints to ensure data consistency","Periodic checkpoints to flush WAL to disk" Recovery,"Redo and undo operations for crash recovery","Redo and undo operations for crash recovery","Redo operations for crash recovery","Redo operations for crash recovery" Performance Impact,"Reduced disk writes due to sequential logging","Reduced disk writes due to sequential logging","Optimized for large-scale data warehousing","Reduced disk writes due to sequential logging" Archiving,"Supports continuous archiving and point-in-time recovery","Supports continuous archiving and point-in-time recovery","Supports data replication and recovery","Supports point-in-time recovery" Configurability,"Various WAL levels (minimal, replica, logical)","Configurable logging levels and checkpoint intervals","Configurable logging and checkpoint settings","Configurable logging and checkpoint settings"