To replicate selected PostgreSQL tables between two VPS servers, configure the source as a publisher with wal_level = logical, create a restricted replication role, allow the destination through pg_hba.conf and the VPS firewall, create a publication, and create a subscription on the second server. PostgreSQL copies the existing rows first, then streams later changes in transaction order. The procedure below covers capacity settings, security, replica identity, validation, monitoring, and recovery.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What logical replication does
Logical replication uses a publisher/subscriber model. The publisher reads row-level changes from its write-ahead log (WAL) and exposes them through one or more publications. The subscriber connects to the publisher, takes an initial snapshot of the published tables, and applies subsequent inserts, updates, and deletes.
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
Changes belonging to a subscription are applied in publisher order, preserving transactional consistency for that subscription. A subscriber can also publish its own tables, which allows cascading designs. Logical replication can connect different major PostgreSQL versions and different operating systems, provided the table definitions and operational behavior are compatible.
This is selective data replication, not a complete server clone. A publication can contain specific tables and operations, while the subscriber remains an ordinary PostgreSQL database that may accept local writes unless you deliberately prevent them.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Decide whether logical replication fits your VPS design
Selective sharing
Use a publication when the destination needs only particular tables or DML operations rather than every database object. This is useful for sending game catalog data, analytics tables, or a regional subset to another server without copying unrelated data.
Migration between PostgreSQL versions
Logical replication can support a cross-version migration: create compatible tables on the new VPS, copy the current contents, keep changes flowing, and switch applications after the destination catches up. Review data types, extensions, generated values, and application behavior before cutover.
Read scaling and consolidation
A subscriber can serve read-heavy workloads or consolidate selected data from several publishers. It is not automatically a conflict-free active-active system. Local writes that collide with incoming changes can stop apply processing.
Cascading replication
A subscriber may publish onward to another PostgreSQL server. Plan the additional slots, workers, network paths, and failure handling at every hop; each hop adds operational dependencies.
Prerequisites before changing PostgreSQL
- Two ordinary PostgreSQL databases on reachable VPS hosts: one publisher and one subscriber.
- A decision about the database and exact tables to replicate.
- Administrative access to PostgreSQL configuration, the operating-system firewall or cloud security group, and both databases.
- A stable network route and a PostgreSQL TCP port exposed only to the intended peer.
- Compatible table definitions on the subscriber. Logical replication does not create schema objects or replicate DDL.
- Enough disk space for the initial table copy, retained WAL, indexes, and normal database growth.
- A secret-management method for the replication password and connection string.
Confirm connectivity from the subscriber to the publisher before creating a subscription. For example, verify that the publisher hostname resolves correctly and that the provider firewall permits the PostgreSQL port from the subscriber’s address. Do not open PostgreSQL to the entire internet merely to test a connection.
Size replication capacity on the publisher
Edit the publisher’s postgresql.conf and set the logical replication parameters:
Free tools Windows power users keep installed
One-click scans. No signup required.
wal_level = logical
max_replication_slots = <subscriptions plus synchronization reserve>
max_wal_senders = <at least max_replication_slots plus physical replicas>
wal_level = logical makes the information needed for logical decoding available. max_replication_slots must cover the expected subscriptions and leave room for synchronization work. max_wal_senders must cover those logical slots plus any physical replication connections.
These are capacity relationships, not universal performance numbers. Count the subscriptions you will actually run, add a reserve for table synchronization and planned growth, and include physical replicas if the same VPS also serves them. More slots consume resources and can retain WAL when a subscriber is inactive, so avoid setting an arbitrary huge value.
Changing wal_level requires a PostgreSQL restart. After restarting, connect to the publisher and verify the effective values:
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
SHOW wal_level;
SHOW max_replication_slots;
SHOW max_wal_senders;
Check the server logs after the restart. A configuration file can contain multiple settings or an included file that overrides your edit; the SHOW result is the value PostgreSQL is actually using.
Create a least-privilege replication role
Create a dedicated login role on the publisher. It needs the REPLICATION attribute so it can use a logical replication connection and LOGIN so the subscriber can authenticate. Grant SELECT on every table included in the publication so PostgreSQL can perform the initial copy.
CREATE ROLE repuser WITH LOGIN REPLICATION PASSWORD 'use-a-secret-manager';
GRANT CONNECT ON DATABASE foo TO repuser;
GRANT USAGE ON SCHEMA public TO repuser;
GRANT SELECT ON TABLE public.users, public.departments TO repuser;
Use the actual database, schema, and table names in your deployment. If you later add a table to the publication, grant the role SELECT on that table before the next synchronization. Avoid granting superuser, ownership, or broad write privileges to the replication role.
Passwords should not appear in shell history, source control, process lists, or documentation. Put the subscription connection string in the deployment’s secret manager and restrict who can read it.
Restrict PostgreSQL network access
Configure pg_hba.conf
Add a narrowly scoped host rule on the publisher. The rule’s address must be the subscriber’s real IP address or private subnet, not a broad example network:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11host all repuser <subscriber-cidr> scram-sha-256
Replace <subscriber-cidr> with the precise address range used by the subscriber. Keep the replication role in its own rule so you can audit and revoke it independently. If your deployment uses TLS certificates or a different authentication method, configure and test that method consistently on both sides.
Reload PostgreSQL after editing pg_hba.conf; a full restart is not normally required for an access-rule change. Validate that the rule matches the connection’s source address and that an earlier rule is not accepting or rejecting the connection first.
Apply the VPS firewall rule
At the operating-system firewall or provider security-group layer, permit the PostgreSQL port only from the subscriber address or private network. If the servers have private networking, prefer that path and avoid exposing the database port on a public interface. Encrypted transport should be used where supported by your deployment; the subscription connection can request TLS with sslmode=require.
Prepare the subscriber database
Create matching tables
Create the target database and tables before creating the subscription. Column order is not required to be identical, but the published columns must map to compatible target columns, and required constraints or defaults must not reject incoming rows. Create indexes and other performance objects you need for subscriber queries separately.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
Because DDL is not replicated, coordinate every schema change yourself. Apply a compatible change to the subscriber before the publisher begins sending rows that depend on it. Test migrations against a staging subscriber when possible.
Reserve slots and workers
On the subscriber, set capacity for its subscriptions and synchronization workers:
max_replication_slots = <subscriptions plus synchronization reserve>
max_logical_replication_workers = <subscriptions plus sync/parallel reserve>
max_worker_processes = <enough for logical workers plus other workers>
max_logical_replication_workers covers apply workers as well as table synchronization and parallel-apply work. max_worker_processes must also leave capacity for unrelated background workers and extensions. If these limits are too low, a subscription may exist but fail to start all of its required workers.
Review which settings require a restart in your PostgreSQL version, restart when necessary, and verify the running values with SHOW commands. Do not treat a VPS’s advertised CPU count as a replication guarantee; worker capacity, storage latency, WAL volume, and network bandwidth determine how quickly a subscriber catches up.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Check replica identity before publishing updates and deletes
For every published table that receives UPDATE or DELETE, configure a replica identity. A primary key is the normal choice:
ALTER TABLE public.users REPLICA IDENTITY DEFAULT;
With the default setting, PostgreSQL uses the primary key to identify the row that changed. Verify that the corresponding key exists and is compatible on the subscriber.
If a table has no practical key, you can use:
ALTER TABLE public.users REPLICA IDENTITY FULL;
REPLICA IDENTITY FULL records enough old row data for PostgreSQL to find the target row, but subscriber lookups can be inefficient, especially for wide or large tables. Treat it as a fallback, not a substitute for designing a stable key. Tables that receive only inserts do not need replica identity for those inserts, but adding updates or deletes later changes the requirement.
Create a publication on the publisher
Connect to the publisher database and define the tables and operations to expose. A basic publication is:
CREATE PUBLICATION mypub
FOR TABLE public.users, public.departments;
Publications are local to one database, and a database can have multiple publications and subscribers. You can limit which DML operations are published or add tables later with ALTER PUBLICATION. Keep the publication narrowly scoped: every additional table increases the initial-copy work, ongoing WAL volume, and schema-coordination burden.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Before proceeding, confirm that every listed table has the required replica identity for its update and delete workload and that the replication role can select it.
Create the subscription on the subscriber
Connect to the target database and create a subscription using a publisher address reachable from the subscriber:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →CREATE SUBSCRIPTION mysub
CONNECTION 'dbname=foo host=publisher.example user=repuser password=REDACTED sslmode=require'
PUBLICATION mypub;
Creating the subscription normally creates or uses a replication slot on the publisher, starts copying existing rows, and then applies ongoing changes. The initial copy can be substantial; estimate its duration from the table size, indexes, storage speed, and available network capacity rather than assuming a fixed rate.
Do not leave the literal password in this example in a real deployment. Supply credentials through your secret-management process and protect configuration files that contain the connection string.
Control the initial copy
During the copy, avoid making uncoordinated writes on the subscriber to the replicated tables. A local insert or update can collide with the incoming row or violate a constraint. If you need a planned cutover, define when applications stop writing, let the subscriber catch up, and then switch clients in a controlled change window.
If a subscription must be created without copying existing rows, PostgreSQL provides subscription options for that design, but using them means the subscriber must already contain a deliberately reconciled data set. Do not use a no-copy approach as a shortcut around schema or data validation.
Validate that replication is working
Inspect the subscriber’s subscription view
On the subscriber, query pg_stat_subscription:
SELECT subname, pid, relid, received_lsn, latest_end_lsn,
latest_end_time
FROM pg_stat_subscription;
An enabled subscription normally has an apply worker. Additional workers can appear during initial table synchronization or parallel apply. A missing process, a null or stale timestamp, or an error in the server log warrants investigation rather than an immediate restart loop.
Check table synchronization
Compare row counts on both sides after the initial copy, allowing for writes that occurred while you measured. For a controlled test, insert a known row on the publisher, wait for it to appear on the subscriber, then update and delete it if the table’s replica identity is configured. Test a transaction containing more than one change when transactional ordering matters to your application.
Read logs and conflict statistics
PostgreSQL server logs show connection failures, permission errors, table-copy failures, and apply-worker stops. On the subscriber, inspect pg_stat_subscription_stats for conflict information and error counters when available in your PostgreSQL version. Correlate those records with the time of the failed transaction and the affected table.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Monitor slots, WAL retention, and apply delay
Replication slots protect changes until the subscriber confirms that it has consumed them. An inactive or stopped subscriber can therefore retain WAL on the publisher and exhaust disk space. Monitor the publisher’s replication slots and WAL retention, and alert on:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute- A subscription with no apply worker when it should be enabled.
- Repeated connection or authentication failures.
- A growing amount of retained WAL for a slot.
- Persistent apply delay or a subscriber that cannot catch up after a workload spike.
- Disk usage approaching the capacity needed for retained WAL and normal database growth.
There is no universal lag threshold that is safe for every VPS workload. Set alert levels from your application’s recovery point, storage headroom, transaction rate, and acceptable catch-up time. Record the baseline during normal operation so an alert reflects a meaningful deviation.
Never drop a replication slot simply to reclaim disk without understanding the consequence. Doing so can require rebuilding or reinitializing the subscription because the missing WAL changes are no longer available.
Resolve conflicts and stopped subscriptions
Constraint conflicts
A duplicate key, missing referenced row, incompatible type, or restrictive check constraint can stop an apply worker. Read the exact server-log error, identify the transaction and table, and compare the conflicting rows on publisher and subscriber. Correct the data or constraint deliberately, then resume the subscription.
Permission conflicts
The apply process needs sufficient privileges on the subscriber tables. A table owner change, revoked permission, or newly added table can prevent changes from applying. Restore the required privileges and verify that the table exists with the expected columns.
Recommended Free Tools
Resume after correction
After fixing the cause, check the subscription state and logs, then enable or resume it using the subscription-management command appropriate to your PostgreSQL version. Confirm that the apply worker returns and that new changes advance again.
Skipping a transaction is an advanced recovery action. It can make the subscriber inconsistent if the skipped change is not reconciled manually. Use it only with a documented repair plan, a backup or restore point, and a subsequent data comparison.
Handle objects logical replication does not cover
- Database schema and DDL:
CREATE TABLE,ALTER TABLE, indexes, permissions, and other schema changes require separate deployment. - Sequence state: sequence values are not automatically kept in sync. A failover or migration plan must copy or advance sequences safely.
- Large objects: large-object data needs a separate transfer and consistency plan.
- Extensions and server settings: install compatible extensions and configure them independently on each VPS.
- Backups: logical replication is not a replacement for tested backups. Keep recovery procedures for both publisher and subscriber.
If the subscriber may become a failover target, document how you will reconcile sequence values, unreplicated objects, application configuration, and writes accepted during an outage. A subscriber that is current for published rows may still be incomplete as a whole application database.
Choose a VPS deployment approach
You can run both servers on self-managed VPS instances or use a managed VPS service. The provider name matters less than whether the environment gives you the controls logical replication requires.
- PostgreSQL control: you need a supported PostgreSQL version and the ability to change
wal_level, slot limits, and worker limits. - Administrative access: root or equivalent database administration access is needed for configuration, logs, and firewall rules.
- Private networking: a private route reduces exposure and usually simplifies firewall scoping.
- Encrypted connections: confirm that TLS can be enabled and that certificates or authentication rules can be managed.
- Storage headroom: provision for the database, indexes, initial-copy staging, retained WAL, and growth.
- Backups and recovery: verify backup frequency, restore testing, and whether you can rebuild a subscriber without provider restrictions.
- Network policy: ensure security groups and host firewalls can allow only the required peer addresses.
Do not choose a plan solely by advertised CPU or memory. Logical replication performance depends on the workload’s change rate, row width, indexes, disk latency, and network throughput. Measure those characteristics in a staging environment before committing to production capacity.
A practical cutover checklist
- Record the publisher and subscriber hostnames, database names, PostgreSQL versions, private addresses, and firewall rules.
- Confirm the subscriber can reach the publisher’s PostgreSQL port over the intended network path.
- Set and verify
wal_level = logical, publisher slot capacity, and WAL-sender capacity. - Create the dedicated login/replication role and grant only the required database, schema, and table privileges.
- Add and reload the narrowly scoped
pg_hba.confrule and test SCRAM/TLS authentication. - Create matching subscriber tables, indexes, extensions, and permissions.
- Set and verify subscriber slot and logical-worker capacity, including the overall worker-process limit.
- Check primary keys or another replica identity on every table receiving updates or deletes.
- Create the publication and confirm its table list and DML scope.
- Create the subscription with a protected connection string and observe the initial copy.
- Verify the apply worker, synchronized tables, test changes, logs, and conflict statistics.
- Set monitoring for worker absence, connection errors, retained WAL, disk pressure, and sustained apply delay.
- Document DDL, sequence, large-object, backup, failover, and conflict-repair procedures.
Common design trade-offs
| Design | What it includes | Main operational concern |
|---|---|---|
| One-way read replica | Published tables and selected DML sent to a read-oriented subscriber | Apply delay, retained WAL, and keeping subscriber-side writes from creating conflicts |
| Selective table replication | Only named tables or operations needed by another workload | Schema and permission changes must be coordinated for every published table |
| Cross-version migration | Existing rows followed by changes until application cutover | Compatibility checks, initial-copy duration, sequence handling, and final write freeze |
| Cascading replication | A subscriber republishes selected data to another subscriber | Extra slots, workers, network paths, lag points, and failure recovery at each hop |
Compare candidate designs by the tables and columns involved, whether the subscriber accepts local writes, initial-copy size, acceptable catch-up time, WAL and storage headroom, conflict behavior, failover requirements, and the effort needed to synchronize schema and sequences.
What success looks like
A successful setup has a reachable and authenticated connection, a publisher with logical WAL enabled, enough slots and senders, a subscriber with enough logical workers, matching tables and replica identities, and an enabled subscription whose apply worker advances after test changes. Operations are not complete until you can detect a stopped worker, explain retained WAL, repair a conflict, and rebuild or fail over without losing track of schema, sequences, large objects, or backups.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




