Questions tagged [django]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
26 views

how setup Logical Replication with PostgreSQL + Django

I am using Postgresql12 + Django app. My intention was to do some replica DB to 2nd node ( in case of failure 1st node, also as a backup) So, I configured on my two nodes : Publisher + Subscriber, But ...
  • 101
0 votes
0 answers
154 views

ORM vs Raw Queries

I am working on a project which I want to eventually launch to the public. In past, I have Used Django which uses ORM to use databases as python models. But I also know that they add extra overhead in ...
0 votes
0 answers
31 views

Errors messages when pusing data with psql on existing database

So I have a remote postgres database hosted on aws's rds, for a django application. This is still in dev (though obviously would like to start trying to do things right already). I need to upload ...
0 votes
1 answer
307 views

Create table with foreign keys blocked by other Table-level Lock

I'm not pretty sure it is database question or development-process question, but I will kindly give it a try. When creating a new table B with foreign keys to table A, the operation tries to acquires ...
2 votes
1 answer
614 views

Sensible max_length for Postgres db charfields

I am using Django with a Postgres backend. In the Django models, I have to set the max_length attribute on the Charfields, then the Django ORM deals with the database in the backend. In a lot of cases,...
1 vote
0 answers
141 views

Storing user defined forms and their data

I'm writing an application that would have a feature similar to Google Forms. In this feature, some end users of the system will have the ability to design custom forms. Those forms will subsequently ...
  • 111
0 votes
1 answer
575 views

Just delete 50.000.000 of rows on a PostgreSQL table and DB still very slow

sorry for my poor english. I have a postgres DB runing on amazon RDS (db.t3.small), with django as a backend. i have made a mistake and created 50.000.000 rows. when i figure out (because queries on ...
0 votes
0 answers
26 views

Reduce mysql query ( Fulltext-search ) execution runtime, server-side?

VPS: ubuntu Django (latest) Python3.6 Mysql Structure : CREATE TABLE `tablename` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) CHARACTER SET latin1 NOT NULL, `wallpaper` ...
1 vote
2 answers
215 views

Why is ASC 100x faster than DESC and what can I do about it?

I'm on the cusp of understanding this, but I don't understand the fix that I need. The following query takes about minute, give or take, to return 20 records: explain (analyze, buffers) select "...
  • 403
2 votes
1 answer
243 views

Duplicate key errors in Postgres queue-like table when rows should be locked by SELECT FOR UPDATE SKIP LOCKED

I have a table called queue with items that need to be processed: CREATE TABLE public.queue ( id serial NOT NULL CONSTRAINT queue_pkey PRIMARY KEY ); Another table process ...
0 votes
1 answer
2k views

Vehicle database design - Type, Make, Model, Vehicle

I kindly ask you for advice, if I am correct with my DB design. I am writing an app in Django (it has its own ORM), which will use PostgreSQL. My expectation is, that I will specify: Type (example: ...
  • 105
0 votes
1 answer
980 views

How to upgrade Mysql 5.5 to 5.6 without data loss on aws-ec2?

MySQL server (5.5) is running on aws-ec2 instance with following linux details NAME="Amazon Linux AMI" VERSION="2015.09" ID="amzn" ID_LIKE="rhel fedora" ...
1 vote
2 answers
351 views

Explaining recurring crash in postgresql deployment

I'm having trouble with unexpected system crashes emanating from a postgresql deployment on a moderately busy production server (Django 1.8 app deployed on DO droplet with a gunicorn application ...
  • 1,869
2 votes
2 answers
2k views

Designing a multi-tenant database for a scenario with multiple user types

I'm developing a SaaS application for recruiting which has multiple user types such as Client, Recruiter, Panellist and Owner etc. There is also a chance that the user types may increase. The Owner ...
0 votes
1 answer
110 views

Why aren't read-only queries executing concurrently? [closed]

I have a Django app using either sqlite or Postgres. (I've tried both and encountered the same problem.) Requesting a particular endpoint results in a read-only query like this that takes 1.5-3 ...
1 vote
0 answers
166 views

django-admin: postgresql trigger function

I have this table in django admin site the (Student_enrollment_record), if i select an student and update/save the Section field and it will search the Section field on what i select on the table (...
  • 111
-1 votes
1 answer
3k views

How to downgrade sqlite3 that comes with Python and Django

So I am stuck in this problem: https://stackoverflow.com/questions/53637182/django-no-such-table-main-auth-user-old I can't upgrade Django because many other applications are connected to it using ...
  • 139
2 votes
1 answer
198 views

UUID as primary key and download ID

I'm designing a Django Rest Framework API with PostgreSQL. In the database I'll be recording information about documents which can be requested for download. I want the request to include a unique id, ...
  • 21
-3 votes
1 answer
200 views

How to copy data from a table to another in O(1) time complexity?

I have a table Customer with fields id, account_balance, etc. At the end of every month at midnight I want to copy the whole list of customers with their account balance to another table(month, year, ...
  • 95
0 votes
0 answers
17 views

Django - Database design improvement

In a simple scenario, where I have many measurements table that describe the measurements that comes from a specific protocol and every measurement is linked to the respective parent device, I was ...
1 vote
0 answers
105 views

How to model complex relationship between three Models in Django

I have to model the following entities: BuildingSite, Company, Worker. Each entity has a many-to-many relationship with the other entities, and each relationship some attributes like start_date, ...
0 votes
0 answers
748 views

Building an Entity-Relationship Diagram for a Language Dictionary

I need advice on how to build entity-relationship diagram (ERD) for Language Dictionary. Since I did not build ERD before, I will try to explain and show the ultimate goal of this project below. ...
0 votes
0 answers
2k views

Authintcation error 28000 + 18456

I have been trying to link my mssql database to Django. When I run the Django server I get the error below. For normal query (out of Django), it works fine, however, the Django doesnt even connect. ...
  • 139
0 votes
1 answer
792 views

django_session table killing my MySQL server and django app

I need your help I hav a Django app that is about 7 years old and have been degrading now..every time the website goes down and back up and the issue is with mysql server Usually i need to just ...
  • 393
4 votes
0 answers
801 views

Database Design for tracking user flow

I want to design a user tracking system between different tables/models. I want to track the user's progress. There is a Module table which is related to sections and sections are related to sub-...
1 vote
0 answers
212 views

Why my heap read/heap hit ratio is negative?

I have a database with 200k rows (one of this column is a jsonb data type column), i'm using this database to store some various devices informations (currents, pressure, etc...) and i'm using this ...
  • 181
1 vote
0 answers
455 views

PGPool II + Django w/ psycopg2 load balancing

I've a pool of applications running django 1.6 with psycopg2 on top of a PGPool II with two backends PostgreSQL servers. But all queries (read and/or write) are going to master PostgreSQL even SELECT. ...
  • 11
1 vote
0 answers
77 views

Scalable way to manage aggregated statistics over time in hierarchy?

I'm using a closure table (Postgres through Django) to roll up stats through a hierarchical tree. When a node that is 10 layers deep has a value that increases, each parent's sum total of that value ...
  • 11
5 votes
2 answers
8k views

Django postgres multiple schema

I'm trying to develop a django interface for an existing postgresql db, the db makes use of various schemas, looking at the literature the following example should work, but it only returns the schema ...
1 vote
2 answers
14k views

How to fix all duplicate key values from sequences?

I have a Postgres database that I created with a Django application. When I transferred it over, it never reindexed anything and it gives me errors trying to do this. It seems as if there are lots of ...
0 votes
1 answer
82 views

Mongo DB Memory Utilisation freezes app needs restart

I am running a project using Mongo DB and Django, I have 2 separate instance for my Django project and database each 16GB ram t2xlarge ubuntu ec2 instances. I am facing issue that within a day or two ...
3 votes
1 answer
176 views

Modelling a database for a travelling business that involves Vehicules, Routes, Subroutes and Prices

I am working on travelling app, where users can book online vehicles to travel. On the customer side I would like this flow: Users have to select a from location and a to location Enter how many ...
  • 131
0 votes
1 answer
1k views

MySQL select returns no rows while there are many

I'm using django to create a database and I manually created a test values in the database by creating objects and saving them to the database. Now when I run this query: select TABLE_NAME, ...
  • 111
1 vote
2 answers
5k views

Psycopg2 - PGBouncer - Postgresql > Server does not support SSL but SSL was required

I've setup my Django application to use SSL while connecting to the Postgresql database via pgbouncer. I'm using Psycopg2 library. I've done this before successfully, so I just did the same steps ...
2 votes
2 answers
351 views

Getting Postgres CREATE TABLE statements

I created some tables (9, to be exact) with a Django (1.9.6) migration and now I'm trying to get simple CREATE TABLE statements for them. I tried this answer, but using pg_dump in this way gives me ...
  • 376
0 votes
1 answer
62 views

Concurrent usage of rdbms, write 4K rows without lockdown [closed]

I am working on a django project using Postgresql. The use case is as follows: A user needs to upload an excel (containing 2.5-4K rows) 2-3 times daily. There will be 100s of users (somewhere between ...
  • 143
0 votes
1 answer
1k views

MySQL query taking a long time

I have a performance issue with a MySQL query that takes a long time. I'm trying to figure out why. I'm using Django, a web framework that comes with ORM (Object relational Mappers) and basically ...
  • 103
2 votes
1 answer
150 views

Field/datatype for searchable address components?

I'm using Django with Postgres, and I'm looking for a field/datatype to store address components that come from Google Places API in this format: "address_components": [ {"long_name": "27", "...
  • 651
1 vote
1 answer
106 views

Are lots of columns or joins better in Django

I am writing a simple Django app that stores and displays user objects with lots of attributes. The user may have up to three hundred attributes. These attributes however, can be grouped off. For ...
0 votes
1 answer
3k views

AWS Postgres RDS dumping data into sql format

My team has hosted a django project in AWS with a Postgres RDS instance. What is the proper way to get export the database into SQL or pg_dump?
  • 103
1 vote
1 answer
580 views

Django Multi Table Inheritance and Preserving Child and Child History

Place can have many different one to one fields, that’s why it can have bookstore, restaurant, and hardware store. But can the same place be both a bookstore and a restaurant at the same time? Now if ...
0 votes
1 answer
68 views

Make a boolean false after every n number of minutes in MySQL

I have a table with a boolean value, if that value is not explicitly set to anything in the database for a few minutes by the back-end (django) then it must automatically be set to false. How do I do ...
user avatar
2 votes
1 answer
222 views

Postgresql tables seem duplicated (with suffixes such us pkey, hashes, etc)

due to some problems I came to check the state of my current database in production and I found that some tables are "duplicated". By duplicated I mean that there appear to be some clones of the ...
  • 123
1 vote
0 answers
31 views

Great slowdown of Django object list retrieval after moving from sqlite3 to mySQL on Amazon RDS

Be warned, there will be some Python programming stuff; my problem is tightly connected to database engine differences though - or at least I think so. tl;dr: Querying for list of items and all ...
  • 123
3 votes
1 answer
3k views

Database in postgresql with missing rows, how to fill the missing rows with a backup copy?

I have a big problem and I'm not that good with postgresql since I use Django to make queries and I only have the basics of sql for querys. My problem is that there was a problem where a super user ...
0 votes
1 answer
687 views

Django Auth user as well as custom users table?

So we've been using djangos database authentication for a while now and have recently decided we want to implement a completely new login system for our website. We are keeping the django ORM as we ...
  • 250