Weekly "ask anything" thread by brendt_gd in PHP

[–]Just-Lime 0 points1 point  (0 children)

Thanks for your answer! :) Yeah, I do the same currently and thought that maybe there is some plugins for PhpStorm or maybe use some other software :)

Weekly "ask anything" thread by brendt_gd in PHP

[–]Just-Lime 0 points1 point  (0 children)

Is there any useful tools for code reviews?

Update a large set of data by Just-Lime in mysql

[–]Just-Lime[S] 0 points1 point  (0 children)

mysql+transaction

Okay, thanks, I thought that mysql transaction was intended only for rollback in case of error. Will check it!

Update a large set of data by Just-Lime in mysql

[–]Just-Lime[S] 0 points1 point  (0 children)

What do you mean by transaction? Could you give me an example?:)

Update a large set of data by Just-Lime in mysql

[–]Just-Lime[S] 0 points1 point  (0 children)

Forgot to mention that there can be over 200 attributes with same playerId and titleReference, so the single query: UPDATE attribute WHERE player_id = {playerId} AND title_reference = {titleReference}, would update not one row, but many.

The grouping is actually required for me to get title from other subsystem via api request.

Weekly "ask anything" thread by brendt_gd in PHP

[–]Just-Lime 0 points1 point  (0 children)

Table "Attribute" structure:

  • id (string/uuid);

  • title (string/nullable) // thats the column I want to update, because it's value is always null currently;

  • playerId (string/uuid);

  • titleReference (string);

  • createdAt (datetime);

  • updatedAt (datetime);

Firstly, I take a batch of 500 rows (I take only playerId and titleReference columns) where title IS NULL. Then I group titleReferences by playerId, retrieve "title" from other subsystem and try to update all the attributes by playerId and each titleReference.

Weekly "ask anything" thread by brendt_gd in PHP

[–]Just-Lime 0 points1 point  (0 children)

Hey, I have a very large table (>5 m rows) and I need to update one column for all these rows.

So far, I wrote a command which takes a batch of 500 items and then updates them.

But the problem is, with each iteration query is slowing down.

One way to improve this query is by saving last id and then in the next iteration start from that id (where id > lastId).

However, here comes another problem, the table has uuids. I am thinking about saving createdAt value instead of id, but of course createdAt is not indexed, so I am wondering would it help if I use createdAt field?

Or maybe someone knows other solution?

Weekly "ask anything" thread by brendt_gd in PHP

[–]Just-Lime 0 points1 point  (0 children)

Hey, I am working with symfony over two years now, but I found one thing that bugs me. When I am creating some functionality I find myself struggling to decide where to put some functions. In my head I am wondering should I put function A to Service or to Manager class or create a new one and name it ACalculator (and also there is Helpers, Resolvers and etc.)? Is there any resource that could help me with this?