Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5930087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:30:32+00:00 2026-05-22T14:30:32+00:00

In Symfony2 doc ‘How to use PdoSessionStorage to store Sessions in the Database’, which

  • 0

In Symfony2 doc ‘How to use PdoSessionStorage to store Sessions in the Database’, which show the session table like this:

CREATE TABLE `session` (
    `session_id` varchar(255) NOT NULL,
    `session_value` text NOT NULL,
    `session_time` int(11) NOT NULL,
    PRIMARY KEY (`session_id`),
    UNIQUE KEY `session_id_idx` (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Why unique key constraint is needed for the primary key?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:30:33+00:00Added an answer on May 22, 2026 at 2:30 pm

    A primary key is by definition a unique key. In this example, it’s just a duplicated unecessary key.

    In other cases, where the primary key could potentially be composite (consisting of two or more fields), such secondary indexes would allow the individual components of the primary key to be addressed seperately.

    For instance:

    create table X {
        a char,
        b char,
        primary key (a,b)
    }
    

    where you do a query with WHERE b=something, would not use the primary key index, as B’s index entries are tied to ‘a’, and you’re not using ‘a’ in the query. Adding a secondary seperate index dedicated to just B allows index use for this where clause.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do something like this https://github.com/brikou/AcmePizzaBundle/blob/master/Entity/Factory/ ... in symfony2 beta1, but it
I'm trying to use the following technique described on symfony.com : http://symfony.com/doc/current/cookbook/testing/http_authentication.html in an
I followed the guide on the very bottom of this article: http://symfony.com/doc/current/cookbook/assetic/asset_management.html I have
Im new in symfony2 framework and i don't know how to store application settings
I have a Symfony2 project with its own database, and now I want to
I'm working on a project based on Symfony2 framework, and I would like to
I use the FacebookBundle to authenticate users in my Symfony2 application. However, I would
Is there a default location to store the PHPUNIT extension? I'm using symfony2 and
doc root: root@helloise:/var/www/symfony2# ls -lah total 8.0K drwxr-xr-x 2 root root 4.0K 2012-01-11 10:04
I'm currently playing around with Symfony2 and like it very much so far. One

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.