Jump to content

Is there a Page ID maximum?


olafgleba
 Share

Recommended Posts

Hi,

in my current project i synchronize a thirdparty database (job advertisments) with my PW Instance every night. To reflect all possibly modified/added/deleted data sets it is mandatory to delete the whole set of related pages (page <=> database row) and rebuild all pages again every sync.

So the page IDs increases constantly every run. I wonder if this could get me into trouble in long term. Is there any restriction of page ID values?

That leads me to a related question. When i build pages through the PW API, is it possible/meaningful to maybe reallocate a (temporarily saved) ID of the deleted pages to the new build pages? To avoid the incrementation...

Thanks for your thoughts in advance.

Olaf 

Link to comment
Share on other sites

The page ID is stored in an unsigned auto-incremented int column (you can find this in ProcessWire's install.sql file) in the pages table in MySQL, so the highest the IDs can go is 4294967295 - that should be plenty ?

You can manually reset an auto-increment column in MySQL, but not lower than the highest value that exists in the table. I guess you could also manually change the column to a BIGINT, I haven't checked but I don't think it would break anything in ProcessWire.

That said, is it really necessary to trash and rebuild all pages every time? I don't know what job advertisements database you have, but if you can get a unique ID or identifier for every job posting from it, you could store that identifier in a hidden field in the corresponding ProcessWire page and then selectively update the fields that have changed (or at least only rebuild the pages that have been changed). This way you also retain meaningful created/modified timestamps inside ProcessWire, so it seems like a better approach.

  • Like 4
Link to comment
Share on other sites

20 minutes ago, MoritzLost said:

I guess you could also manually change the column to a BIGINT, I haven't checked but I don't think it would break anything in ProcessWire.

FYI: I've been running two sites with that modification to the database without any errors or issues.

  • Like 5
Link to comment
Share on other sites

3 hours ago, MoritzLost said:

That said, is it really necessary to trash and rebuild all pages every time? [...] This way you also retain meaningful created/modified timestamps inside ProcessWire, so it seems like a better approach.

I absolutely agree. Currently the synchronisation is in development and testing. The database (or better said, the distributors API) only provides a very narrow set of interrogations. And has some strange data field types also (e.g. row modified is delivered, but internaly stored as a string type in a unusal format). So the create/delete of pages every import is just for testing purposes. If all is set and stable (and i can rely on the DB modified field), your approach is definitely the way to go.

The questions (page ID limitation? Reset...) came up while testing. And i was curious about it ?

Thx for you answer (also to @rick)
Olaf

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...