[{"data":1,"prerenderedAt":644},["ShallowReactive",2],{"navigation_docs":3,"-advanced-postgresql":106,"-advanced-postgresql-surround":639},[4,26,57,83],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":25},"Getting Started","i-lucide-rocket","/getting-started","1.getting-started",[10,15,20],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","/getting-started/introduction","1.getting-started/1.introduction","i-lucide-info",{"title":16,"path":17,"stem":18,"icon":19},"Installation","/getting-started/installation","1.getting-started/2.installation","i-lucide-download",{"title":21,"path":22,"stem":23,"icon":24},"Quick Start","/getting-started/quick-start","1.getting-started/3.quick-start","i-lucide-play",false,{"title":27,"icon":28,"path":29,"stem":30,"children":31,"page":25},"Core Concepts","i-lucide-book-open","/essentials","2.essentials",[32,37,42,47,52],{"title":33,"path":34,"stem":35,"icon":36},"Models","/essentials/models","2.essentials/1.models","i-lucide-box",{"title":38,"path":39,"stem":40,"icon":41},"Collections","/essentials/collections","2.essentials/2.collections","i-lucide-folder",{"title":43,"path":44,"stem":45,"icon":46},"Views","/essentials/views","2.essentials/3.views","i-lucide-table",{"title":48,"path":49,"stem":50,"icon":51},"Schema Evolution","/essentials/schema-evolution","2.essentials/4.schema-evolution","i-lucide-git-branch",{"title":53,"path":54,"stem":55,"icon":56},"Relations","/essentials/relations","2.essentials/5.relations","i-lucide-link",{"title":58,"icon":59,"path":60,"stem":61,"children":62,"page":25},"Advanced","i-lucide-settings","/advanced","3.advanced",[63,68,73,78],{"title":64,"path":65,"stem":66,"icon":67},"Time-Series","/advanced/time-series","3.advanced/1.time-series","i-lucide-chart-line",{"title":69,"path":70,"stem":71,"icon":72},"Async Support","/advanced/async","3.advanced/2.async","i-lucide-zap",{"title":74,"path":75,"stem":76,"icon":77},"PostgreSQL","/advanced/postgresql","3.advanced/3.postgresql","i-lucide-database",{"title":79,"path":80,"stem":81,"icon":82},"Performance Guide","/advanced/performance","3.advanced/4.performance","i-lucide-gauge",{"title":84,"icon":85,"path":86,"stem":87,"children":88,"page":25},"API Reference","i-lucide-file-code","/api","4.api",[89,94,98,101],{"title":90,"path":91,"stem":92,"icon":93},"Engine","/api/engine","4.api/1.engine","i-lucide-cog",{"title":95,"path":96,"stem":97,"icon":41},"Collection","/api/collection","4.api/2.collection",{"title":33,"path":99,"stem":100,"icon":36},"/api/models","4.api/3.models",{"title":102,"path":103,"stem":104,"icon":105},"Exceptions","/api/exceptions","4.api/4.exceptions","i-lucide-alert-triangle",{"id":107,"title":74,"body":108,"description":632,"extension":633,"links":634,"meta":635,"navigation":636,"path":75,"seo":637,"stem":76,"__hash__":638},"docs/3.advanced/3.postgresql.md",{"type":109,"value":110,"toc":622},"minimark",[111,115,119,122,155,166,170,176,265,279,284,334,338,341,477,489,493,496,553,569,573,577,593,597,618],[112,113,114],"p",{},"CentauroDB supports PostgreSQL as an alternative backend. The Python API is identical — you change the connection string and everything else works the same. This guide covers setup, differences, and when to choose PostgreSQL over SQLite.",[116,117,16],"h2",{"id":118},"installation",[112,120,121],{},"Install the PostgreSQL extra:",[123,124,129],"pre",{"className":125,"code":126,"language":127,"meta":128,"style":128},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pip install \"centaurodb[postgres]\"\n","bash","",[130,131,132],"code",{"__ignoreMap":128},[133,134,137,141,145,149,152],"span",{"class":135,"line":136},"line",1,[133,138,140],{"class":139},"sBMFI","pip",[133,142,144],{"class":143},"sfazB"," install",[133,146,148],{"class":147},"sMK4o"," \"",[133,150,151],{"class":143},"centaurodb[postgres]",[133,153,154],{"class":147},"\"\n",[112,156,157,158,165],{},"This installs ",[159,160,164],"a",{"href":161,"rel":162},"https://www.psycopg.org/",[163],"nofollow","psycopg",", the modern PostgreSQL adapter for Python.",[116,167,169],{"id":168},"connecting","Connecting",[112,171,172,173,175],{},"Pass a PostgreSQL connection URL to ",[130,174,90],{},":",[123,177,181],{"className":178,"code":179,"language":180,"meta":128,"style":128},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from centaurodb import Engine, Collection\n\nengine = Engine(\"postgresql://user:password@localhost:5432/mydb\")\ncoll = Collection(engine, \"monitoring\")\n","python",[130,182,183,205,212,238],{"__ignoreMap":128},[133,184,185,189,193,196,199,202],{"class":135,"line":136},[133,186,188],{"class":187},"s7zQu","from",[133,190,192],{"class":191},"sTEyZ"," centaurodb ",[133,194,195],{"class":187},"import",[133,197,198],{"class":191}," Engine",[133,200,201],{"class":147},",",[133,203,204],{"class":191}," Collection\n",[133,206,208],{"class":135,"line":207},2,[133,209,211],{"emptyLinePlaceholder":210},true,"\n",[133,213,215,218,221,224,227,230,233,235],{"class":135,"line":214},3,[133,216,217],{"class":191},"engine ",[133,219,220],{"class":147},"=",[133,222,198],{"class":223},"s2Zo4",[133,225,226],{"class":147},"(",[133,228,229],{"class":147},"\"",[133,231,232],{"class":143},"postgresql://user:password@localhost:5432/mydb",[133,234,229],{"class":147},[133,236,237],{"class":147},")\n",[133,239,241,244,246,249,251,254,256,258,261,263],{"class":135,"line":240},4,[133,242,243],{"class":191},"coll ",[133,245,220],{"class":147},[133,247,248],{"class":223}," Collection",[133,250,226],{"class":147},[133,252,253],{"class":223},"engine",[133,255,201],{"class":147},[133,257,148],{"class":147},[133,259,260],{"class":143},"monitoring",[133,262,229],{"class":147},[133,264,237],{"class":147},[112,266,267,268,271,272,271,275,278],{},"Everything else works exactly the same — ",[130,269,270],{},"write_object()",", ",[130,273,274],{},"read_objects()",[130,276,277],{},"create_view()",", all query operators, relations, time-series. Your Python code is backend-agnostic.",[280,281,283],"h3",{"id":282},"url-formats","URL formats",[123,285,287],{"className":178,"code":286,"language":180,"meta":128,"style":128},"# Standard\nEngine(\"postgresql://user:password@localhost:5432/mydb\")\n\n# Alternate scheme\nEngine(\"postgres://user:password@localhost:5432/mydb\")\n",[130,288,289,295,309,313,318],{"__ignoreMap":128},[133,290,291],{"class":135,"line":136},[133,292,294],{"class":293},"sHwdD","# Standard\n",[133,296,297,299,301,303,305,307],{"class":135,"line":207},[133,298,90],{"class":223},[133,300,226],{"class":147},[133,302,229],{"class":147},[133,304,232],{"class":143},[133,306,229],{"class":147},[133,308,237],{"class":147},[133,310,311],{"class":135,"line":214},[133,312,211],{"emptyLinePlaceholder":210},[133,314,315],{"class":135,"line":240},[133,316,317],{"class":293},"# Alternate scheme\n",[133,319,321,323,325,327,330,332],{"class":135,"line":320},5,[133,322,90],{"class":223},[133,324,226],{"class":147},[133,326,229],{"class":147},[133,328,329],{"class":143},"postgres://user:password@localhost:5432/mydb",[133,331,229],{"class":147},[133,333,237],{"class":147},[116,335,337],{"id":336},"what-changes-under-the-hood","What changes under the hood",[112,339,340],{},"While the Python API stays identical, CentauroDB adapts the SQL it generates:",[342,343,344,358],"table",{},[345,346,347],"thead",{},[348,349,350,353,356],"tr",{},[351,352],"th",{},[351,354,355],{},"SQLite",[351,357,74],{},[359,360,361,376,395,414,431,444,460],"tbody",{},[348,362,363,370,373],{},[364,365,366],"td",{},[367,368,369],"strong",{},"Setup",[364,371,372],{},"Zero — built into Python",[364,374,375],{},"Requires a running PostgreSQL server",[348,377,378,383,389],{},[364,379,380],{},[367,381,382],{},"Connection",[364,384,385,386],{},"File path or ",[130,387,388],{},"\":memory:\"",[364,390,391,394],{},[130,392,393],{},"postgresql://"," URL",[348,396,397,402,408],{},[364,398,399],{},[367,400,401],{},"JSON storage",[364,403,404,407],{},[130,405,406],{},"json()"," text",[364,409,410,413],{},[130,411,412],{},"JSONB"," (binary, faster queries)",[348,415,416,421,426],{},[364,417,418],{},[367,419,420],{},"JSON extraction",[364,422,423],{},[130,424,425],{},"json_extract(meta, '$.field')",[364,427,428],{},[130,429,430],{},"meta->>'field'",[348,432,433,438,441],{},[364,434,435],{},[367,436,437],{},"Concurrency",[364,439,440],{},"Single-writer",[364,442,443],{},"Multi-writer",[348,445,446,451,457],{},[364,447,448],{},[367,449,450],{},"Async",[364,452,453,454],{},"Needs ",[130,455,456],{},"check_same_thread=False",[364,458,459],{},"Thread-safe by default",[348,461,462,467,472],{},[364,463,464],{},[367,465,466],{},"Install",[364,468,469],{},[130,470,471],{},"pip install centaurodb",[364,473,474],{},[130,475,476],{},"pip install \"centaurodb[postgres]\"",[478,479,480,481,484,485,488],"callout",{"icon":14},"The SQL dialect differences are handled internally by CentauroDB. You never need to think about ",[130,482,483],{},"json_extract"," vs ",[130,486,487],{},"->>"," — just write Python.",[116,490,492],{"id":491},"starting-with-sqlite-moving-to-postgresql","Starting with SQLite, moving to PostgreSQL",[112,494,495],{},"A common pattern is to develop locally with SQLite and deploy to production with PostgreSQL. The migration path is straightforward — change one line:",[123,497,499],{"className":178,"code":498,"language":180,"meta":128,"style":128},"# Development\nengine = Engine(\"app.db\")\n\n# Production\nengine = Engine(\"postgresql://user:pass@db-host/myapp\")\n",[130,500,501,506,525,529,534],{"__ignoreMap":128},[133,502,503],{"class":135,"line":136},[133,504,505],{"class":293},"# Development\n",[133,507,508,510,512,514,516,518,521,523],{"class":135,"line":207},[133,509,217],{"class":191},[133,511,220],{"class":147},[133,513,198],{"class":223},[133,515,226],{"class":147},[133,517,229],{"class":147},[133,519,520],{"class":143},"app.db",[133,522,229],{"class":147},[133,524,237],{"class":147},[133,526,527],{"class":135,"line":214},[133,528,211],{"emptyLinePlaceholder":210},[133,530,531],{"class":135,"line":240},[133,532,533],{"class":293},"# Production\n",[133,535,536,538,540,542,544,546,549,551],{"class":135,"line":320},[133,537,217],{"class":191},[133,539,220],{"class":147},[133,541,198],{"class":223},[133,543,226],{"class":147},[133,545,229],{"class":147},[133,547,548],{"class":143},"postgresql://user:pass@db-host/myapp",[133,550,229],{"class":147},[133,552,237],{"class":147},[112,554,555,556,271,558,271,561,564,565,568],{},"No code changes, no model changes, no view recreation. The same ",[130,557,95],{},[130,559,560],{},"TimeSeriesCollection",[130,562,563],{},"create_view",", and ",[130,566,567],{},"create_index"," calls work on both backends.",[570,571,572],"tip",{},"You can start development with SQLite and switch to PostgreSQL for deployment — just change the connection URL. No code changes required.",[116,574,576],{"id":575},"when-to-use-postgresql","When to use PostgreSQL",[578,579,580,584,587,590],"ul",{},[581,582,583],"li",{},"You need concurrent writers (multiple processes or services writing to the same database)",[581,585,586],{},"You need a network-accessible database (shared across services)",[581,588,589],{},"You're deploying to a server environment with existing PostgreSQL infrastructure",[581,591,592],{},"You need advanced PostgreSQL features via raw SQL (full-text search, triggers, etc.)",[116,594,596],{"id":595},"when-to-stick-with-sqlite","When to stick with SQLite",[578,598,599,602,605,608,615],{},[581,600,601],{},"Local development, prototyping, Jupyter notebooks",[581,603,604],{},"Embedded applications (CLI tools, desktop apps)",[581,606,607],{},"Single-user scenarios or single-writer workloads",[581,609,610,611,614],{},"You want zero infrastructure — just a ",[130,612,613],{},".db"," file",[581,616,617],{},"Edge/IoT deployments where simplicity matters",[619,620,621],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}",{"title":128,"searchDepth":207,"depth":207,"links":623},[624,625,628,629,630,631],{"id":118,"depth":207,"text":16},{"id":168,"depth":207,"text":169,"children":626},[627],{"id":282,"depth":214,"text":283},{"id":336,"depth":207,"text":337},{"id":491,"depth":207,"text":492},{"id":575,"depth":207,"text":576},{"id":595,"depth":207,"text":596},"Switch from SQLite to PostgreSQL — same API, server-grade backend.","md",null,{},{"icon":77},{"title":74,"description":632},"koOteagL3Dp-aNA6dAUAjztxQxFN_n3o40KBUxy1Htg",[640,642],{"title":69,"path":70,"stem":71,"description":641,"icon":72,"children":-1},"Use AsyncCollection and AsyncTimeSeriesCollection for non-blocking database operations in async applications.",{"title":79,"path":80,"stem":81,"description":643,"icon":82,"children":-1},"Indexes, view tuning, and model-level optimizations to get the most out of CentauroDB.",1781105062463]