performance – SQL vs NoSQL for a table with millions insert per day

Currently, I have a project using MySQL. I need to create a new table that will insert millions data every day. The select query usage is quite rare(maybe about 5 times fetch/select per day), but most of the columns is needed for filtering and ordering, so I can’t save compressed data. I need to minimize storage usage for that table. The performance is slightly slower is no problem(but if significant maybe I will consider it).

The table consists of about 12 columns, 3 columns are datetime, 2 columns are biginterger, and other are string. Each string column value is about 5-50 char length. maybe average will be 15 chars.

Which is better for my needs, still use MySQL table or use NoSQL like MongoDB?

As far as I know, NoSQL consume a lot of space because of denormalized column, but I think in my case it’s not a problem, because I just need a single table. Am I really need NoSQL?

postgresql – Undo INSERT in WITH statement ON CONFLICT in Postgres

In my Postgres 13 database I have a master table suggestions and multiple child tables with different sets of columns, two of them are movie_edit_suggestions and series_edit_suggestions.

The id of the child tables are foreign keys to the id of the master table and ids are unique across all child tables, i.e. id “1” can’t exist in both movie_edit_suggestions and release_edit_suggestions.

In these child tables there are a pair of columns that must be unique within each table:

author integer NOT NULL,
field text NOT NULL

These tables also has the value text NOT NULL column. If the same author tries to do two inserts with the same field then the latest value should update the existing one.

CREATE TYPE suggestion_type AS ENUM (

CREATE TABLE suggestions (
    suggestion_type suggestion_type NOT NULL,
    author integer NOT NULL

ALTER TABLE ONLY suggestions
    ADD CONSTRAINT suggestions_id_suggestion_type_author_key UNIQUE (id, suggestion_type, author);

CREATE TABLE movie_edit_suggestions (
    author integer NOT NULL,
    field text NOT NULL,
    value text NOT NULL,
    suggestion_type suggestion_type DEFAULT 'change_movie'::suggestion_type,
    CONSTRAINT movie_edit_suggestions_suggestion_type_check CHECK ((suggestion_type = 'change_movie'::suggestion_type))

CREATE UNIQUE INDEX unique_movie_edit_suggestions ON movie_edit_suggestions USING btree (field, author);

ALTER TABLE ONLY movie_edit_suggestions
    ADD CONSTRAINT movie_edit_suggestions_id_suggestion_type_author_fkey FOREIGN KEY (id, suggestion_type, author) REFERENCES suggestions(id, suggestion_type, author) ON DELETE CASCADE;

CREATE TABLE series_edit_suggestions (
    author integer NOT NULL,
    field text NOT NULL,
    value text NOT NULL,
    suggestion_type suggestion_type DEFAULT 'change_series'::suggestion_type,
    CONSTRAINT series_edit_suggestions_suggestion_type_check CHECK ((suggestion_type = 'change_series'::suggestion_type))

CREATE UNIQUE INDEX unique_series_edit_suggestions ON series_edit_suggestions USING btree (field, author);

ALTER TABLE ONLY series_edit_suggestions
    ADD CONSTRAINT series_edit_suggestions_id_suggestion_type_author_fkey FOREIGN KEY (id, suggestion_type, author) REFERENCES suggestions(id, suggestion_type, author) ON DELETE CASCADE;

I’m trying to do this with CTE’s but by first attempt results in duplicate suggestions entries:

WITH suggestion AS (
    INSERT INTO suggestions (suggestion_type, author) VALUES ('change_movie', 1)
INSERT INTO movie_edit_suggestions
(id, suggestion_type, field, value, author)
((SELECT id FROM suggestion), 'change_movie', 'title', 'Star Wars', 1)
ON CONFLICT (field, author) DO UPDATE SET value = 'Star Wars';

-- Another one

WITH suggestion AS (
    INSERT INTO suggestions (suggestion_type, author) VALUES ('change_movie', 1)
INSERT INTO movie_edit_suggestions
(id, suggestion_type, field, value, author)
((SELECT id FROM suggestion), 'change_movie', 'title', 'Star Wars: New Hope', 1)
ON CONFLICT (field, author) DO UPDATE SET value = 'Star Wars: New Hope'
SELECT * FROM movie_edit_suggestions
id author field value suggestion_type
1 1 title Star Wars: New Hope change_movie
SELECT * FROM suggestions
id suggestion_type author
1 change_movie 1
2 change_movie 1

Swapping the inserts results in an error when inserting to both child tables:

WITH movie_edit_suggestion AS (
    INSERT INTO movie_edit_suggestions
    (suggestion_type, field, value, author)
    ('change_movie', 'title', 'Star Wars', 1)
    ON CONFLICT (field, author) DO UPDATE SET value = 'Star Wars'
    id, field, value

INSERT INTO suggestions (id, suggestion_type, author)
VALUES ((SELECT id FROM movie_edit_suggestion), 'change_movie', 1)

-- Another one

WITH series_edit_suggestion AS (
    INSERT INTO series_edit_suggestions
    (suggestion_type, field, value, author)
    ('change_series', 'title', 'Breaking Bad', 1)
    ON CONFLICT (field, author) DO UPDATE SET value = 'Breaking Bad'
    id, field, value

INSERT INTO suggestions (id, suggestion_type, author)
VALUES ((SELECT id FROM series_edit_suggestion), 'change_series', 1)

ERROR: duplicate key value violates unique constraint “suggestions_pkey”
DETAIL: Key (id)=(1) already exists.

Full dbfiddle showcasing both attempts

sharepoint online – Why can’t insert data to Custom List?

I create a Custom List from AddIns

enter image description here

I had use Page : Lists/QuanLyWorkFlow/AllItems.aspx and checked it insert data ok.
enter image description here

But If i use code to insert from my addins:

var phongbanid = $("#cboDepartment").val();
var status_from = $("#cboStatus_From").val();
var status_to = $("#cboStatus_To").val();
var member_id = $("#cboMember").val();  
var email_to = $("#txtEmail_To").val(); 
var CC = $("#txtEmail_CC").val(); 
var BCC = $("#txtEmail_BCC").val(); 
var email_Title = $("#txtEmail_Title").val(); 
var email_body = $("#txtEmail_Body").val(); 
 var oList = clientContext.get_web().get_lists().getByTitle('QuanLyWorkFlow');
    var itemCreateInfo = new SP.ListItemCreationInformation();
    var oListItem = oList.addItem(itemCreateInfo);
    oListItem.set_item('PhongBan', phongbanid);
    oListItem.set_item('Status_From', status_from);
    oListItem.set_item('Status_To', status_to);
    oListItem.set_item('Member', member_id);
    oListItem.set_item('EmailTo', email_to);
    oListItem.set_item('EmailCC', CC);
    oListItem.set_item('EmailBCC', BCC);
    oListItem.set_item('EmailTitle', email_Title);
    oListItem.set_item('EmailBody', email_body);
    clientContext.executeQueryAsync(Function.createDelegate(this, function (sender, args) {
        alert('Item created: ' + oListItem.get_id());            
    }), Function.createDelegate(this, function (sender, args) {
        alert('Request failed. ' + args.get_message() + 'n' + args.get_stackTrace());

It occur error:

"Column 'EmailTo' does not exist. It may have been deleted by another user.  /sites/demo/SharePointAddIn2/Lists/QuanLyWorkFlow"

But If i close columns: EmailTo, EmailCC,EmailBCC, EmailTitle, EmailBody , it is ok.

Why i can’t insert data to columns: EmailTo, EmailCC,EmailBCC, EmailTitle, EmailBody?

I had try create new site and deploy addins, but it still occur error the same.

postgresql – Postgres insert query automation

In our organization, we are creating a new table where all the employees’ tasks, time spent on a task, and various fields will be there, basically an activity tracking table, from which we can extract some data as we have some tools for data visualisation.

Some of the team members don’t have Postgres experience at all. We currently have two ways, upload the CSV and give the specific query so that they can update the table.. but both of them are manual tasks, so, Is there any way or tool through which these insertions can be automated and easy for all.

Why does wp_insert_term insert 2 terms when using dynamic slug

I’d like to dynamically generate the slug for a term. But I always end up with 2 entries in the database.

I came up this minimal working example:
When I run this code below, I end up with 2 entries in the database


term_id  name   slug  
284      test   list-66603_1610659731  
285      test   list-29853_1610659732
function test_submit_list()
    $slug = 'list-'. random_int(1,100000) .'_'. time();

    $term = wp_insert_term(
            'description' => 'Slug: "'.$slug.'"',
            'slug'        => $slug,
            'parent'      => 25,

The function is called by an AJAX:

$("#list-form").on('submit', function(e) {

        var form = {
            action: 'test_submit_list',

        $.post(test_obj.ajax_url, form).always(function(data) {

When I change the first line to $slug = 'list-'. 12345 .'_'. 11111111;, I only get one entry.

Can someone please explain to me what is going on? This is driving me crazy.

c++ – insert binary heap in C language without using sub functions and imported libraries

the code must be in C language ,
After adding it should be converted back into heap shape ,
enter image description here

struct node {
     int key;
     struct node * parent, * left_link, * right_link;
struct heap {
struct node * root;
struct node * last_added;

void heap_insert(struct heap *heap,int key){
//-- the code --

javascript – Not able to insert data into TaskList In sharepoint Spfx

Using SP-Pnp-Js Library, I am not able to insert data from a webpart into the sharepoint Tasklist.

private SubmitWorkflowForm(): void {

var TaskNameVal = document.getElementById('taskName')('value');
var StartDateVal = document.getElementById('startDate')('value');
var DueDateVal = document.getElementById('dueDate')('value');
var AssignedToVal = document.getElementById('assignedTo')('value');
var CompleteVal = document.getElementById('complete')('value');
var DescriptionVal = document.getElementById('description')('value');
var PriorityVal = document.getElementById('priority')('value');
var statusVal = document.getElementById('Status')('value');

const siteurl: string = + "/_api/web/lists/getbytitle('TestTask')/items";
  Title: TaskNameVal,
  StartDate: StartDateVal,
  DueDate: DueDateVal,
  PercentComplete: CompleteVal,
  AssignedTo: AssignedToVal,
  Body: DescriptionVal,
  Priority: PriorityVal,
  Status: statusVal,
}).then(r => {

In the AssignedTo variable, I am using the “Users Email’s value

“value”:”A ‘PrimitiveValue’ node with non-null value was found when trying to read the value of a navigation property; however, a ‘StartArray’ node, a ‘StartObject’ node, or a ‘PrimitiveValue’ node with null value was expected.”

postgresql – insert or update row based on timestamp

I’m looking for a solution in postgresql to insert or update a row, based on the timestamp of that row.

What I’m looking for is the following:

I want to insert the use of a specific hashtag, and count this use, based on the last hour.

| hashtag     | count | timestamp                  |
| hello       | 1     | 2020-01-01 12:00:00+00.00  |
| world       | 3     | 2020-01-01 12:00:00+00.00  |
| hello       | 2     | 2020-01-01 11:00:00+00.00  |
| ...                                              |

What I want to achieve:

I want to insert a new row if there is no row for the specific hashtag in the last hour created (based on the timestamp). If a row exists with timestamp > NOW() - INTERVAL '1 HOUR', I just want to update the count of that row.

How can I achieve this? Can I do this with a CHECK-constraint?

Insert custom data to custom table on wordpress database

i need some help here

i wanna create some form for user to subscribe our article and store the data to database. i have tried to search it on google, but nothing worked when i tried that. i know that some plugin can do that but i dont know how to create the validation when user already subscribed and the form never show again.

how do i do to insert the data to my database?
hope you guys understand what the problem and any help will appreciate

thank you

here is my code

the form

                    <form action="<?php echo site_url() . '/insert-data.php'; ?>" method="POST" name="form-subscribe">
                        <div class="row">
                            <div class="col-12 col-lg-12 col-md-12">
                                <input type="text" name="subs_name" placeholder="Full Name*" required="">                               
                        <div class="row mt-3">
                            <div class="col-12 col-lg-12 col-md-12">
                                <input type="text" name="subs_email" placeholder="Email Address*" required="">                              
                        <div class="row mt-3">
                            <div class="col-12 col-lg-12 col-md-12">
                                <p><button type="submit" class="btn btn-primary" name="submitForm">Submit</button></p>

the action file aka insert-data.php


    //setting up the form
    function insertuser() {

      $name   = $_POST('subs_name');
      $email  = $_POST('subs_email');  

      global $wpdb; 
      $table_name = $wpdb->prefix . "subscriber";
      $wpdb->insert($table_name, array('subs_name' => $name, 'subs_email' => $email) );

if( isset($_POST('submitForm')) ) insertuser();


Here is the table of wp_subscriber
enter image description here

how to insert date in oracle

use TO_CHAR function and convert your date format as you want (as long as it is valid format):

select to_char(sysdate,’dd/Mon/yyyy’) from dual – to display date in DD/Mon/YYYY format. No time displayed.

select to_char(sysdate,’dd-Mon-yyyy’) from dual – to display date in DD-Mon-YYYY format. No time displayed.

select to_char(sysdate,’dd-Mon-yyyy hh24:mi:ss’) from dual – will display date and time in hh24:mi:ss format.