Skip to content

Tags

#databases

Posts tagged #databases on Dynamo Geeks: 15 posts from the community, most useful first.

15 posts

Posts tagged #databases

  1. Experience

    Blameless review: the 'quick' migration that blocked every write to our orders table

    Short incident review, because the lesson is more useful than the embarrassment. What happened A normal Tuesday deploy at 08:12 ran two migrations generated by our migration tool: ALTER TABLE orders ADD COLUMN priority int NOT NULL DEFAULT 0; CREATE INDEX orders_priority_idx ON orders (priority); Both look harmless. Since Postgres 11, adding a column with a constant default does not rewrite the table, so the ALTER…

    Bram Verhoeven19likes9comments

  2. Experience

    Teaching SQL joins to Class 12 with the attendance register and the fee register

    Every year my Class 12 children memorise "INNER JOIN returns only matching rows" for the exam, write it perfectly, and understand nothing. This year I tried something different and it worked better than I expected, so I am sharing. I borrowed two real registers from the office: the attendance register (roll number, name) and the fee register (roll number, term, amount). I asked the children: "Who has paid fees, with…

    Anitha Joseph37likes10comments

  3. Question

    Django endpoint does 300+ queries, select_related vs prefetch_related confusion

    Hi, I am intern at a fintech, writing internal API in Django REST Framework. Endpoint /api/transfers/ returns 50 transfers and django-debug-toolbar shows 312 queries xD Models: Transfer has two ForeignKeys to Account (sender, receiver), Account has ForeignKey to Customer , and Transfer has ManyToMany tags . class TransferViewSet(viewsets.ReadOnlyModelViewSet): queryset = Transfer.objects.select_related("sender",…

    Kacper Nowicki13likes9comments

  4. Article

    Your Go service has 600 Postgres connections and uses 6 of them

    Last month a routine scale-up took down our orders database. Not CPU, not disk. Connections. Postgres said FATAL: sorry, too many clients already and every service that touched it fell over together. How we got there 40 pods of one Go service, each with a pgx pool. Nobody had set MaxConns , so pgxpool used its default: the larger of 4 and runtime.NumCPU() . Our nodes have 16 cores. 40 times 16 is 640 possible…

    Danny Cho22likes8comments

  5. Article

    Two cashiers, one last bottle of kecap: fixing overselling in a Laravel POS with row locks

    One of my clients is a small minimarket chain, 4 stores, 6 cashiers per store at peak. Last Lebaran, the day before the holiday, the stock report showed -14 bottles of kecap manis . Negative stock. The owner asked me, very politely, how we sold 14 bottles that do not exist. Good question, mas. The bug $product = Product::find($id); if ($product->stock < $qty) { throw new OutOfStock($product); }…

    Bayu Setiawan14likes9comments

  6. Question

    boss wants 'chat with your data' by Q4. anyone actually running LLM-to-SQL for business users?

    hi all. data analyst kat a bank in KL. my boss went to a vendor event and now he wants "chat with your data" for the business users by Q4 lah. type a question in English or Malay, get the answer from our warehouse. sounds very nice on the slide. my worries, maybe I am overthinking: our schema has 600+ tables, column names like TXN_AMT_2 and CUST_FLG_X . even humans don't know what they mean. "revenue" means 3…

    Nurul Aisyah8likes8comments

  7. Experience

    The SELECT * that stopped month-end at our bank, and the change ticket that saved me

    Friends, a story from month-end, because I am telling you, every bank sysadmin has one of these and mine finally has a happy ending. Last day of the month, 11.40 pm. Our core banking batch on Oracle runs interest, fees, GL postings, and at the end the ATM and card settlement files for the switch. The batch window is tight. At 11.52 pm the batch stopped moving. Monitoring showed the TEMP tablespace at 100% and the…

    Chaminda Perera9likes8comments

  8. Article

    The index that made our query slower, and other things EXPLAIN ANALYZE told me

    Short version: someone added an index "because we order by that column", and the dispatcher dashboard went from 40 ms to 9 seconds for our smallest depots. The someone was me. I found out on the bike home, which is 14 km, which is enough time to stop being angry at yourself. The query SELECT id, reference, created_at FROM shipments WHERE depot_id = 42 AND status = 'pending' ORDER BY created_at DESC LIMIT 50;…

    Bram Verhoeven41likes13comments

  9. Question

    Multi-tenant Laravel for 40 koperasi: one database with tenant_id, or one database per tenant?

    Hello all. I maintain a savings and loan system (koperasi simpan pinjam) used by 40 cooperatives. Same features for all, each has 2,000 to 20,000 members. Laravel 10, PHP 8.2, MySQL 8, one VPS. Now it is single database, every table has koperasi_id , and I use a global scope: class KoperasiScope implements Scope { public function apply(Builder $builder, Model $model): void { $builder->where(…

    Bayu Setiawan4likes8comments

  10. Article

    Your Laravel app is not slow. Your loop is.

    A Dubai client called last month. "The admin is slow, maybe we need a bigger server?" The orders page took 6.1 seconds. I opened Debugbar and the query counter said 1,214 . For one page. Of 50 orders. The server was fine. The loop was not. The code (simplified, but not by much) // OrderController@index $orders = Order::latest()->paginate(50); {{-- orders/index.blade.php --}} @foreach ($orders as $order) <tr> <td>{{…

    Ayesha Siddiqui16likes11comments

  11. Experience

    Dear friends, a story from 1984: a power cut, 40,000 punched cards and the word CHECKPOINT

    Dear friends, My grandson tells me that nobody reads long posts any more. I have told him that I am 62 and I have time, and so, kindly, do you. This is a story from my first year in the bank, and it has a lesson at the end which I believe is still useful, although the machines have changed beyond recognition. I joined the data processing department of our bank's head office in Madras (it became Chennai only later)…

    S. Ramanathan13likes9comments

Get the best of Dynamo Geeks weekly

One email each Monday with the most useful posts. No spam; unsubscribe in one click.