We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

3

No, those are not "duplicated", those are additional relations/objects created for the tables. reversion_revision_pkey is most probably the unique index supporting the primary key for the table reversion_revision. And the others are most probably indexes as well. You can add this expression to your query to see the actual type of the relation: case ...


3

You can restore all affected tables into a different schema, there are a variety of ways in which you can do that (several good ideas in https://stackoverflow.com/questions/4191653/i-want-to-restore-the-database-with-a-different-schema). Once the table is in a separate schema, you can compare them by primary key, and insert the missing ones, like so for ...


3

I'm not sure how to phrase this, but this type of application isn't what Django is made for. Django is made for simple CRUD based websites, with an admin interface that comes for free, but I don't think trying to shoehorn a search engine in an MVC framework is going to work very well. (however there may be extensions by now, my Django experience is old and ...


2

There is an interesting thing in RDS postgresql. I had the same issue, normal pg_dump won't work. Use the below command pg_dump -Fc -v -h [endpoint of instance] -U [master username] [database] > [database].dump Refer link: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html


2

The reason that this command worked: psql --set=sslmode=verify-full -h DBHOST -p DBPORT -U USERNAME DBNAME Is that --set just creates a user-defined variable inside the psql program with the name of 'sslmode'. That name is not special to psql, it does nothing with your connection options and you just connect without ssl.


2

The code you display is not related to "reindexing". (Compare: REINDEX). It gets a sequence behind a serial column (or IDENTITY column in Postgres 10 or later) back in sync - by setting it to the maximum existing ID. Consider this query instead: SELECT setval('tablename_id_seq', max(id)) FROM tablename; No subselect needed, no off-by-one error to fix (the ...


2

The problem is that SELECT COUNT(*) FROM django_session WHERE django_session.last_login >= '2019-02-23 13:00:37' is a slow query. Your process list is showing this taking 3133 seconds so far and hasn't completed. If there was an index on the last_login column in django_session this would likely be quicker. ALTER TABLE django_session ADD KEY (last_login) ...


2

UPDATE: see this answer for a working example of the below How would I store it? What you've got is User data (formatted_address) Normalized address breakdown (address_components) I would store only the formatted_address or whatever the user provided. Why? I don't trust Django or whatever you're integrating with I want the ability to re-normalize ...


1

The problem is if the table grows large, the time to copy will keep on increasing and it would allow system to make changes to the balance while it's being copied. Yes, but your copy doesn't have to care about that. When doing an INSERT INTO target_table SELECT ... FROM source_table ..., any change that occur in source_table during the INSERT is ignored....


1

Here is a super easy project example with 2 apps and 3 schemes that cross each other with ForeignKey https://github.com/mullerivan/DjangomultipleSchema The idea is to define each model with the schema and table that need to use class Meta: db_table = u'"app1\".\"on_app_one"'


1

I did similar work to this many moons ago - I worked for an airline, but it's more or less the same thing! A critical thing to get right from the start is terminology - yes, I know that you just want to start coding! :-) However, life will be much easier if everyone is singing off the same hymnsheet! In the airline for which I worked, the word "flight" had ...


1

I tried manually adding a test user and the TABLE_ROWS was updated "4270" but when I select I get only the test user I added. Anyway, I learned that TABLE_ROWS is only a rough estimate and I guess it is not updated regularly enough.


1

This may be the most silly answer, but when I changed my pgbouncer file, it worked like a charm. client_tls_sslmode = verify-full client_tls_key_file = /var/lib/postgresql/9.5/main/server.key client_tls_cert_file = /var/lib/postgresql/9.5/main/server.crt client_tls_ca_file = /var/lib/postgresql/9.5/main/rootCA.crt part was just after the [databases] part, ...


1

SELECT `id`, `company_name`, `status`, `company_uid`, `company_zipcode`, `company_city`, `company_canton` FROM `trackdata_lead` AS tl WHERE `site_id` = 41 AND EXISTS( SELECT * FROM `trackdata_trackrecord` AS tr WHERE tl.id = tr.lead_id AND `timestamp` >= '2016-12-20 23:...


1

I understand you might not still be looking but it might help someone else. The best way to do this, in my opinion, would be a simple OneToOne or ForeignKey on your new model to User. In the admin you can override the User admin and add an inline: class FbDetailsInline(admin.TabularInline): model = FbDetails extra = 1 # Or however many you would ...


Only top voted, non community-wiki answers of a minimum length are eligible